Expand description
VmClosureHandle — a read-only shim over the raw closure backing.
§Closure spec §14.2
Closure state is stored in crate::heap_value::HeapValue::ClosureRaw,
backed by a raw *const TypedClosureHeader block whose capture layout
is described by a ClosureLayout. VmClosureHandle is the stable
read API over that backing — readers go through the handle so any
future backing changes remain contained.
Track A.5 retired the legacy HeapValue::Closure { function_id, upvalues } variant and its ClosureBacking::Legacy shim variant —
every closure is now ClosureRaw-backed.
§API surface
ⓘ
handle.function_id() // u32 function table index
handle.type_id() // u32 ClosureTypeId
handle.capture_count()
handle.capture_as_value(i) // widen capture i to ValueWord
handle.captures_as_values() // Vec<ValueWord> of all captures
handle.refcount() // exact refcount on the blockStructs§
- VmClosure
Handle - Read-only handle to a closure’s function id, type id, and captures.