pub enum Val {
Unit,
Int(i64),
Float(f64),
Str(Arc<str>),
Bool(bool),
Keyword(Arc<str>),
List(Arc<Vec<Val>>),
Record(Arc<Vec<(Arc<str>, Val)>>),
Syntax(Node),
Fun(Arc<Lambda>),
Type(Arc<TyRepr>),
}Expand description
A compile-time value.
Val::Syntax is the one that makes this a macro interpreter rather than a calculator: a
quote: block evaluates to one, $e inside a template puts one back, and every other variant
has a reflection into syntax so that $n where n is 3 is the literal
3.
Variants§
Unit
Int(i64)
Float(f64)
Str(Arc<str>)
Bool(bool)
Keyword(Arc<str>)
List(Arc<Vec<Val>>)
Record(Arc<Vec<(Arc<str>, Val)>>)
Syntax(Node)
Fun(Arc<Lambda>)
Type(Arc<TyRepr>)
What node_ty(e) answers with: the type the checker gave an expression
(crate::typed). Only a typed macro’s body can hold one, because only there has anything
been inferred.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Val
impl RefUnwindSafe for Val
impl Send for Val
impl Sync for Val
impl Unpin for Val
impl UnwindSafe for Val
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more