typst_library/foundations/sys.rs
1//! System-related things.
2
3use crate::foundations::{Dict, Module, Scope, Version};
4
5/// A module with system-related things.
6pub fn module(inputs: Dict) -> Module {
7 let mut scope = Scope::deduplicating();
8 scope.define(
9 "version",
10 Version::from_iter([
11 env!("CARGO_PKG_VERSION_MAJOR").parse::<u32>().unwrap(),
12 env!("CARGO_PKG_VERSION_MINOR").parse::<u32>().unwrap(),
13 env!("CARGO_PKG_VERSION_PATCH").parse::<u32>().unwrap(),
14 ]),
15 );
16 scope.define("inputs", inputs);
17 Module::new("sys", scope)
18}