diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-01-03 12:29:35 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-01-03 12:32:17 +0100 |
| commit | 29b31c4a5ac4cde311c4d38b3d70130e7d27ba76 (patch) | |
| tree | fe4e5dbd2166a69af90e69578ad4602725cdb63c /src/model/value.rs | |
| parent | 54962e6dcd002fd27918827996155fd7dc4e1cff (diff) | |
New import syntax
Diffstat (limited to 'src/model/value.rs')
| -rw-r--r-- | src/model/value.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/model/value.rs b/src/model/value.rs index 0716985d..8103b211 100644 --- a/src/model/value.rs +++ b/src/model/value.rs @@ -7,7 +7,7 @@ use std::sync::Arc; use siphasher::sip128::{Hasher128, SipHasher}; use super::{ - format_str, ops, Args, Array, Cast, CastInfo, Content, Dict, Func, Label, Str, + format_str, ops, Args, Array, Cast, CastInfo, Content, Dict, Func, Label, Module, Str, }; use crate::diag::StrResult; use crate::geom::{Abs, Angle, Color, Em, Fr, Length, Ratio, Rel, RgbaColor}; @@ -52,6 +52,8 @@ pub enum Value { Func(Func), /// Captured arguments to a function. Args(Args), + /// A module. + Module(Module), /// A dynamic value. Dyn(Dynamic), } @@ -86,6 +88,7 @@ impl Value { Self::Dict(_) => Dict::TYPE_NAME, Self::Func(_) => Func::TYPE_NAME, Self::Args(_) => Args::TYPE_NAME, + Self::Module(_) => Module::TYPE_NAME, Self::Dyn(v) => v.type_name(), } } @@ -109,6 +112,7 @@ impl Value { Self::Str(v) => item!(text)(v.into()), Self::Content(v) => v, Self::Func(_) => Content::empty(), + Self::Module(module) => module.content(), _ => item!(raw)(self.repr().into(), Some("typc".into()), false), } } @@ -150,6 +154,7 @@ impl Debug for Value { Self::Dict(v) => Debug::fmt(v, f), Self::Func(v) => Debug::fmt(v, f), Self::Args(v) => Debug::fmt(v, f), + Self::Module(v) => Debug::fmt(v, f), Self::Dyn(v) => Debug::fmt(v, f), } } @@ -189,6 +194,7 @@ impl Hash for Value { Self::Dict(v) => v.hash(state), Self::Func(v) => v.hash(state), Self::Args(v) => v.hash(state), + Self::Module(v) => v.hash(state), Self::Dyn(v) => v.hash(state), } } @@ -402,6 +408,7 @@ primitive! { Content: "content", primitive! { Array: "array", Array } primitive! { Dict: "dictionary", Dict } primitive! { Func: "function", Func } +primitive! { Module: "module", Module } primitive! { Args: "arguments", Args } #[cfg(test)] |
