summaryrefslogtreecommitdiff
path: root/src/eval/value.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-06-26 13:57:21 +0200
committerLaurenz <laurmaedje@gmail.com>2023-06-27 18:40:17 +0200
commit7b92bd7c340d9f9c094ed2fa57912049317d9b20 (patch)
treeb91399526ba94d87309d09d864df2935dd7a4d0a /src/eval/value.rs
parent9c7f31870b4e1bf37df79ebbe1df9a56df83d878 (diff)
Basic package management
Diffstat (limited to 'src/eval/value.rs')
-rw-r--r--src/eval/value.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/eval/value.rs b/src/eval/value.rs
index 91fdadbe..b1782cab 100644
--- a/src/eval/value.rs
+++ b/src/eval/value.rs
@@ -15,9 +15,10 @@ use crate::diag::StrResult;
use crate::geom::{Abs, Angle, Color, Em, Fr, Length, Ratio, Rel};
use crate::model::{Label, Styles};
use crate::syntax::{ast, Span};
+use crate::util::Bytes;
/// A computational value.
-#[derive(Clone, Default)]
+#[derive(Default, Clone)]
pub enum Value {
/// The value that indicates the absence of a meaningful value.
#[default]
@@ -46,6 +47,8 @@ pub enum Value {
Symbol(Symbol),
/// A string: `"string"`.
Str(Str),
+ /// Raw bytes.
+ Bytes(Bytes),
/// A label: `<intro>`.
Label(Label),
/// A content value: `[*Hi* there]`.
@@ -103,6 +106,7 @@ impl Value {
Self::Color(_) => Color::TYPE_NAME,
Self::Symbol(_) => Symbol::TYPE_NAME,
Self::Str(_) => Str::TYPE_NAME,
+ Self::Bytes(_) => Bytes::TYPE_NAME,
Self::Label(_) => Label::TYPE_NAME,
Self::Content(_) => Content::TYPE_NAME,
Self::Styles(_) => Styles::TYPE_NAME,
@@ -186,6 +190,7 @@ impl Debug for Value {
Self::Color(v) => Debug::fmt(v, f),
Self::Symbol(v) => Debug::fmt(v, f),
Self::Str(v) => Debug::fmt(v, f),
+ Self::Bytes(v) => Debug::fmt(v, f),
Self::Label(v) => Debug::fmt(v, f),
Self::Content(v) => Debug::fmt(v, f),
Self::Styles(v) => Debug::fmt(v, f),
@@ -228,6 +233,7 @@ impl Hash for Value {
Self::Color(v) => v.hash(state),
Self::Symbol(v) => v.hash(state),
Self::Str(v) => v.hash(state),
+ Self::Bytes(v) => v.hash(state),
Self::Label(v) => v.hash(state),
Self::Content(v) => v.hash(state),
Self::Styles(v) => v.hash(state),
@@ -400,6 +406,7 @@ primitive! {
Str,
Symbol(symbol) => symbol.get().into()
}
+primitive! { Bytes: "bytes", Bytes }
primitive! { Label: "label", Label }
primitive! { Content: "content",
Content,