diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-12-15 20:27:41 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-12-15 20:27:41 +0100 |
| commit | 2a3d0f4b390457174ed09347dd29e97ff9a783e4 (patch) | |
| tree | 0e0634bff6b7f64131267f4cbe05651c1c91d900 /src/eval/value.rs | |
| parent | 244ad386ec271ff86a2101eb4cc38d37a55552b9 (diff) | |
Set Rules Episode VII: The Set Awakens
Diffstat (limited to 'src/eval/value.rs')
| -rw-r--r-- | src/eval/value.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/eval/value.rs b/src/eval/value.rs index 2cf82a26..0995ab75 100644 --- a/src/eval/value.rs +++ b/src/eval/value.rs @@ -4,7 +4,7 @@ use std::fmt::{self, Debug, Formatter}; use std::hash::Hash; use std::rc::Rc; -use super::{ops, Array, Dict, Function, Node}; +use super::{ops, Array, Class, Dict, Function, Node}; use crate::diag::StrResult; use crate::geom::{Angle, Color, Fractional, Length, Linear, Relative, RgbaColor}; use crate::layout::Layout; @@ -46,6 +46,8 @@ pub enum Value { Node(Node), /// An executable function. Func(Function), + /// A class of nodes. + Class(Class), /// A dynamic value. Dyn(Dynamic), } @@ -86,6 +88,7 @@ impl Value { Self::Dict(_) => Dict::TYPE_NAME, Self::Node(_) => Node::TYPE_NAME, Self::Func(_) => Function::TYPE_NAME, + Self::Class(_) => Class::TYPE_NAME, Self::Dyn(v) => v.type_name(), } } @@ -148,6 +151,7 @@ impl Debug for Value { Self::Dict(v) => Debug::fmt(v, f), Self::Node(_) => f.pad("<template>"), Self::Func(v) => Debug::fmt(v, f), + Self::Class(v) => Debug::fmt(v, f), Self::Dyn(v) => Debug::fmt(v, f), } } @@ -394,6 +398,7 @@ primitive! { Array: "array", Array } primitive! { Dict: "dictionary", Dict } primitive! { Node: "template", Node } primitive! { Function: "function", Func } +primitive! { Class: "class", Class } impl Cast<Value> for Value { fn is(_: &Value) -> bool { |
