Expand description
Reference handles for capturing singletons, optionals, and streams in q!() closures.
Each handle type wraps a &RefCell<HydroNode> and, when captured inside a q!() closure,
registers itself with the current capture scope. At codegen time, the IR node is lowered
to the corresponding DFIR pseudo-operator (singleton(), optional(), or handoff()),
and the reference resolves to the appropriate borrow type.
Each handle tracks the Location and the boundedness of the collection it refers to
(see OperatorContext). A handle can only be captured inside closures passed to operators
on collections with a matching location and boundedness. This is required for soundness:
a bounded collection is only materialized on the first tick, while closures on unbounded
collections continue to run on later ticks, where the referenced value no longer exists and
accessing it would crash at runtime.
Re-exports§
pub use SingletonRef as _;pub use SingletonMut as _;pub use OptionalRef as _;pub use OptionalMut as _;pub use StreamRef as _;pub use StreamMut as _;
Structs§
- Optional
Mut - A mutable reference handle to an optional, resolves to
&mut Option<T>at runtime. - Optional
Ref - A shared reference handle to an optional, resolves to
&Option<T>at runtime. - Singleton
Mut - A mutable reference handle to a singleton, resolves to
&mut Tat runtime. - Singleton
Ref - A shared reference handle to a singleton, resolves to
&Tat runtime. - Stream
Mut - A mutable reference handle to a stream’s handoff buffer, resolves to
&mut Vec<T>at runtime. - Stream
Ref - A shared reference handle to a stream’s handoff buffer, resolves to
&Vec<T>at runtime.
Enums§
- Handoff
RefKind - Determines which DFIR pseudo-operator a reference node lowers to.
Functions§
- with_
ref_ capture - Activate the reference capture context. Must be called before
q!()expansion that may capture handoff references. Returns aClosureExprbundling the expression with any captured references.