Expand description
Centralized extraction helpers for ValueWord values.
These require_* functions provide a single source of truth for extracting
typed values from ValueWord, returning descriptive VMError on type mismatch.
They replace scattered ad-hoc patterns like:
ⓘ
let s = nb.as_str()
.ok_or_else(|| VMError::TypeError { expected: "string", got: "other" })?;Functions§
- nb_
to_ display_ string - Convert a ValueWord to a display string.
- require_
arc_ string - Extract an Arc
reference from a ValueWord, or return a type error. - require_
array - Extract an array view from a ValueWord, or return a type error.
- require_
bool - Extract a bool from a ValueWord, or return a type error.
- require_
closure - Extract Closure fields (function_id, upvalues) from a ValueWord, or return a type error.
- require_
datatable - Extract a DataTable reference from a ValueWord, or return a type error.
- require_
f64 - Extract an f64 from a ValueWord, or return a type error.
- require_
int - Extract an i64 from a ValueWord, or return a type error.
- require_
number - Extract a number (f64 or i64 coerced to f64) from a ValueWord, or return a type error.
- require_
string - Extract a string reference from a ValueWord, or return a type error.
- require_
typed_ object - Extract TypedObject fields (schema_id, slots, heap_mask) from a ValueWord, or return a type error.