Skip to main content

Module handoff_ref

Module handoff_ref 

Source
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§

OptionalMut
A mutable reference handle to an optional, resolves to &mut Option<T> at runtime.
OptionalRef
A shared reference handle to an optional, resolves to &Option<T> at runtime.
SingletonMut
A mutable reference handle to a singleton, resolves to &mut T at runtime.
SingletonRef
A shared reference handle to a singleton, resolves to &T at runtime.
StreamMut
A mutable reference handle to a stream’s handoff buffer, resolves to &mut Vec<T> at runtime.
StreamRef
A shared reference handle to a stream’s handoff buffer, resolves to &Vec<T> at runtime.

Enums§

HandoffRefKind
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 a ClosureExpr bundling the expression with any captured references.