pub enum Value {
Undef,
Bool(bool),
Int(i64),
Float(f64),
Str(Arc<String>),
Array(Vec<Value>),
Hash(HashMap<String, Value>),
Status(i32),
Ref(Box<Value>),
NativeFn(u16),
Obj(u32),
}Expand description
Core value type — what lives on the stack and in variables.
Designed to be small (1 word tag + 1-2 words payload) so the dispatch loop stays cache-friendly.
Variants§
Undef
No value / uninitialized
Bool(bool)
Boolean (from conditionals, [[ ]], etc.)
Int(i64)
64-bit signed integer
Float(f64)
64-bit float
Str(Arc<String>)
Heap-allocated string (Arc for cheap clone in closures)
Array(Vec<Value>)
Ordered array of values
Hash(HashMap<String, Value>)
Key-value associative array
Status(i32)
Exit status code (shell-specific but universal enough)
Ref(Box<Value>)
Reference to another value (for pass-by-reference, nested structures)
NativeFn(u16)
Native function pointer (builtin dispatch)
Obj(u32)
Opaque handle into a frontend object heap (e.g. elisp cons/symbol/vector
cells). The frontend’s extension handler/host owns the pointed-to object;
fusevm just carries the handle through the stack, slots, and globals.
Identity-comparable (the handle is the identity), which is what elisp
eq/setcar need and Array could not provide.
Implementations§
Source§impl Value
impl Value
Sourcepub fn str(s: impl Into<String>) -> Value
pub fn str(s: impl Into<String>) -> Value
Construct a string Value::Str from any type that converts to String.
The payload is wrapped in Arc so clones are cheap.
Sourcepub fn status(code: i32) -> Value
pub fn status(code: i32) -> Value
Construct a Value::Status(code) — used for $? / pipeline-exit
values so a numeric exit code stays distinguishable from plain
Value::Int(n) in is_truthy / display logic.
Sourcepub fn as_str_cow(&self) -> Cow<'_, str>
pub fn as_str_cow(&self) -> Cow<'_, str>
Coerce to string, borrowing when possible to avoid allocation.
Returns Cow::Borrowed for Str, Undef, Bool, Hash, Ref variants.