Skip to main content

Module dynamics

Module dynamics 

Source
Expand description

Thread-local dynamic variable binding stack.

binding forms push a frame onto BINDING_STACK for the duration of their body; the RAII BindingGuard pops it on drop (handles both normal return and panics).

Structs§

BindingGuard
Pops the innermost binding frame when dropped.

Functions§

capture_current
Snapshot the current thread’s entire binding stack (for conveyance into a child thread, e.g. future).
deref_var
Check the thread-local stack first (innermost frame wins); fall back to the root binding stored in the Var itself.
install_frames
Install a previously captured snapshot on the current (new) thread.
is_thread_bound
True if var has any thread-local binding on this thread.
push_frame
Push a new dynamic binding frame; return a guard that pops it on drop.
set_thread_local
Set the innermost thread-local binding for var. Returns false if no thread-local binding exists (caller should fall back to setting the root).
trace_current
Trace all values in the current thread’s binding stack as GC roots. Call this during the GC root enumeration phase.
var_key_of

Type Aliases§

VarKey
Opaque key for a Var in the binding stack (pointer identity). Stable because the GC is non-moving.