Enum Value Copy item path Source pub enum Value {
Int(i64 ),
Float(f64 ),
Bool(bool ),
String(SeqString ),
Variant(Box <VariantData >),
Map(Box <HashMap <MapKey , Value >>),
Quotation(usize ),
Closure {
fn_ptr: usize ,
env: Arc <[Value ]>,
},
}Expand description Value: What the language talks about
This is pure data with no pointers to other values.
Values can be pushed on the stack, stored in variants, etc.
The key insight: Value is independent of Stack structure.
Floating-point value (IEEE 754 double precision)
String (arena or globally allocated via SeqString)
Variant (sum type with tagged fields)
Map (key-value dictionary with O(1) lookup)
Keys must be hashable types (Int, String, Bool)
Quotation (stateless function pointer stored as usize for Send safety)
No captured environment - backward compatible
Closure (quotation with captured environment)
Contains function pointer and Arc-shared array of captured values.
Arc enables TCO: no cleanup needed after tail call, ref-count handles it.
Fields Function pointer (transmuted to function taking Stack + environment)
Captured values from creation site (Arc for TCO support)
Ordered top-down: env[0] is top of stack at creation
Performs copy-assignment from
source.
Read more Formats the value using the given formatter.
Read more Tests for self and other values to be equal, and is used by ==.
Tests for !=. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Convert to serializable TypedValue
Serialize directly to bytes
Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more 🔬 This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From <T> for U chooses to do.
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer.
Read more Mutably dereferences the given pointer.
Read more Drops the object pointed to by the given pointer.
Read more The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more Uses borrowed data to replace owned data, usually by cloning.
Read more The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.