pub enum Value {
Show 28 variants
Byte(u8),
Int([u8; 7]),
Float(F56),
CodePoint(char),
CharCluster(u8, [u8; 6]),
CharClusterLong(Handle),
Symbol(Interned),
Keyword(Interned),
StringConst(Interned),
Special(Interned),
Builtin(u32),
True,
False,
Nil,
Undefined,
String(Handle),
Vector(Handle),
Map(Handle),
Bytes(Handle),
Pair(Handle),
List(Handle, u16),
Lambda(Handle),
Closure(Handle),
Continuation(Handle),
CallFrame(Handle),
Value(Handle),
Error(Handle),
Io(Handle),
}
Variants§
Byte(u8)
Int([u8; 7])
Store a 7 byte int (i56…).
Float(F56)
Replace with float::F32Wrap if desired
CodePoint(char)
CharCluster(u8, [u8; 6])
CharClusterLong(Handle)
Handle points to a String on the heap.
Symbol(Interned)
Keyword(Interned)
StringConst(Interned)
Special(Interned)
Intended for symbols that are compiled.
Builtin(u32)
True
False
Nil
Undefined
Value is a placeholder only, should never appear at runtime. Can be instantiated at times as a placeholder but should always be overwritten.
String(Handle)
Vector(Handle)
Map(Handle)
Bytes(Handle)
Pair(Handle)
List(Handle, u16)
Lambda(Handle)
Closure(Handle)
Continuation(Handle)
CallFrame(Handle)
Value(Handle)
Error(Handle)
Io(Handle)
Implementations§
Source§impl Value
impl Value
pub fn new() -> Self
pub fn unref<ENV>(self, vm: &GVm<ENV>) -> Value
pub fn get_symbol(&self) -> Option<Interned>
pub fn is_symbol(&self, sym: Interned) -> bool
pub fn is_indirect(&self) -> bool
pub fn is_nil(&self) -> bool
pub fn is_undef(&self) -> bool
pub fn is_true(&self) -> bool
pub fn is_truthy(&self) -> bool
pub fn is_false(&self) -> bool
pub fn is_falsey(&self) -> bool
pub fn is_int(&self) -> bool
pub fn is_number(&self) -> bool
pub fn is_float(&self) -> bool
pub fn not(&self) -> Value
pub fn get_int<ENV>(&self, vm: &GVm<ENV>) -> VMResult<i64>
pub fn get_float<ENV>(&self, _vm: &GVm<ENV>) -> VMResult<f64>
pub fn get_string<'vm, ENV>(&self, vm: &'vm GVm<ENV>) -> VMResult<&'vm str>
pub fn get_handle(&self) -> Option<Handle>
pub fn get_pair<ENV>(&self, vm: &GVm<ENV>) -> Option<(Value, Value)>
Sourcepub fn iter<'vm, ENV>(
&self,
vm: &'vm GVm<ENV>,
) -> Box<dyn Iterator<Item = Value> + 'vm>
pub fn iter<'vm, ENV>( &self, vm: &'vm GVm<ENV>, ) -> Box<dyn Iterator<Item = Value> + 'vm>
Returns an iterator over all values in the list, vector, pair. If the item is not one of the above it returns an empty iterator.
Sourcepub fn iter_all<'vm, ENV>(
&self,
vm: &'vm GVm<ENV>,
) -> Box<dyn Iterator<Item = Value> + 'vm>
pub fn iter_all<'vm, ENV>( &self, vm: &'vm GVm<ENV>, ) -> Box<dyn Iterator<Item = Value> + 'vm>
Returns an iterator over all values in the list, vector, pair. Returns an empty iterator if the value is nil. If the item is not one of the above it returns a once iter of the value.
Particularly useful if iterating over a Vec<Value>
that contains a heterogeneous
mix of List(s), Vector(s), Pair(s), and potentially other values, rather than
returning an empty list for any non-iterable thing, return a once iter so
the item is not missed.