diff options
| author | Martin Haug <mhaug@live.de> | 2022-05-27 16:39:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-27 16:39:06 +0200 |
| commit | 73086b5a7c1b0f9f638165803c237901499adb64 (patch) | |
| tree | c120a2449aaf325cb675ea3363ee69758a734d86 /src/eval/value.rs | |
| parent | 99cb655832161d4ebec73273a15453a8f6acc1b7 (diff) | |
| parent | 8ba11b0722599892499337b3272cec38945d11de (diff) | |
Merge pull request #71 from typst/pins
Diffstat (limited to 'src/eval/value.rs')
| -rw-r--r-- | src/eval/value.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/eval/value.rs b/src/eval/value.rs index b47d1e91..9b36812a 100644 --- a/src/eval/value.rs +++ b/src/eval/value.rs @@ -11,7 +11,7 @@ use crate::geom::{ Angle, Color, Dir, Em, Fraction, Length, Paint, Ratio, Relative, RgbaColor, Sides, }; use crate::library::text::RawNode; -use crate::model::{Content, Layout, LayoutNode, Pattern}; +use crate::model::{Content, Group, Layout, LayoutNode, Pattern}; use crate::syntax::Spanned; use crate::util::EcoString; @@ -73,6 +73,14 @@ impl Value { Self::Content(Content::block(node)) } + /// Create a new dynamic value. + pub fn dynamic<T>(any: T) -> Self + where + T: Type + Debug + PartialEq + Hash + Sync + Send + 'static, + { + Self::Dyn(Dynamic::new(any)) + } + /// The name of the stored value's type. pub fn type_name(&self) -> &'static str { match self { @@ -653,6 +661,10 @@ dynamic! { Regex: "regular expression", } +dynamic! { + Group: "group", +} + castable! { usize, Expected: "non-negative integer", |
