Expand description
Iterator-state carrier — the kinded redesign of the deleted
heap_value::IteratorState / IteratorTransform ValueWord-shaped enums.
ADR-006 §2.7.16 / Q17 (W13-iterator-state, 2026-05-10). Lazy iterator
pipelines are represented as a plain typed Arc<IteratorState> whose
payload is (a) a typed IteratorSource over an existing Arc<T>-backed
collection and (b) an ordered list of typed IteratorTransform stages.
Each transform that takes a callback stores the closure carrier as
Arc<HeapValue> directly per ADR-006 §2.7.11 / Q12 — the value-call ABI
is kind-aware via KindedSlot at the dispatch boundary, so a stored
closure flows back into vm.call_value_immediate_nb as a fresh
KindedSlot { kind: Ptr(HeapKind::Closure), .. } carrier whose share is
bumped from the stored Arc<HeapValue>.
Slot bits for an Iterator-labeled slot are
Arc::into_raw(Arc<IteratorState>) as u64 (mirror of §2.7.9 FilterExpr
/ §2.7.13 Reference — NOT a Box::into_raw(Box<HeapValue>) wrap).
clone_with_kind / drop_with_kind retain/release Arc<IteratorState>
directly via the HeapKind::Iterator dispatch arm. slot.as_heap_value()
IS valid on Iterator-labeled bits — unlike FilterExpr/Reference,
HeapValue::Iterator(Arc<IteratorState>) participates in the §2.3
typed-Arc payload pattern, and the dispatch shell may recover the
state via the canonical slot.as_heap_value() → HeapValue::Iterator
match (the iterator method handlers use this path).
No new dispatch surface is introduced — clone_with_kind /
drop_with_kind / KindedSlot::clone / KindedSlot::drop /
TypedObjectStorage::drop / SharedCell::drop each grow one new arm
(the same shape as the §2.7.9 FilterExpr / §2.7.12 SharedCell /
§2.7.13 Reference precedents).
Structs§
- Iterator
State - Lazy iterator carrier. Stored on the heap as
Arc<IteratorState>; the runtime slot label isNativeKind::Ptr(HeapKind::Iterator).
Enums§
- Iterator
Source - Source backing a lazy iterator pipeline. Each variant holds a typed
Arc<T>over an existing collection so iteration shares the receiver’s storage without a deep copy. - Iterator
Transform - Lazy transform stage in an iterator pipeline. Each closure-bearing
variant stores the callback as
Arc<HeapValue>per ADR-006 §2.3 / §2.7.11 — the same share carrier theop_call_value/call_value_immediate_nbpath consumes (the slot bits at the §2.7.7 stack tier areArc::into_raw(Arc<HeapValue>)pointing to aHeapValue::ClosureRaw(OwnedClosureBlock)arm; the iterator-state stash here keeps an extra share alive for the iterator’s lifetime).