summaryrefslogtreecommitdiff
path: root/crates/typst-syntax/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/typst-syntax/src')
-rw-r--r--crates/typst-syntax/src/file.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/typst-syntax/src/file.rs b/crates/typst-syntax/src/file.rs
index f5fa493b..8f07cc92 100644
--- a/crates/typst-syntax/src/file.rs
+++ b/crates/typst-syntax/src/file.rs
@@ -265,6 +265,17 @@ pub struct PackageVersion {
pub patch: u32,
}
+impl PackageVersion {
+ /// The current compiler version.
+ pub fn compiler() -> Self {
+ Self {
+ major: env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap(),
+ minor: env!("CARGO_PKG_VERSION_MINOR").parse().unwrap(),
+ patch: env!("CARGO_PKG_VERSION_PATCH").parse().unwrap(),
+ }
+ }
+}
+
impl FromStr for PackageVersion {
type Err = EcoString;