pub enum Value {
Int(i32),
Float(f32),
Bool(bool),
String(Arc<str>),
List(Arc<ListValue>),
DivertTarget(DefinitionId),
VariablePointer(DefinitionId),
TempPointer {
slot: u16,
frame_depth: u16,
},
Null,
FragmentRef(u32),
}Expand description
A runtime value in the ink VM.
Heap-allocating variants (String, List) are wrapped in Arc so that
cloning a Value is always O(1) — a refcount bump, not a deep copy.
This matches C#’s reference-type semantics and makes call-frame cloning
(during fork_thread) essentially free. Atomic refcounts are used so
Value can flow through Bevy’s parallel scheduler.
Variants§
Int(i32)
Float(f32)
Bool(bool)
String(Arc<str>)
List(Arc<ListValue>)
DivertTarget(DefinitionId)
VariablePointer(DefinitionId)
A reference to a global variable, used for ref parameters.
TempPointer
A runtime-only pointer to a temp in a specific call frame.
Used for ref parameters that target temp variables.
Null
FragmentRef(u32)
A reference to a fragment in the output buffer’s fragment store. Fragments preserve structural output parts for locale re-rendering.
Implementations§
Source§impl Value
impl Value
Sourcepub fn value_type(&self) -> ValueType
pub fn value_type(&self) -> ValueType
Return the type discriminant for this value.
Sourcepub fn as_int(&self) -> Option<i32>
pub fn as_int(&self) -> Option<i32>
Extract an i32 if this value is an Int.
Strict: does not coerce floats or booleans. Returns None for any
other variant. For binding authors that want to read an integer
argument from ink.