Represents the current state of all locals for a given execution context.
Represents the current state of all locals for a given execution context.
This should be treated as an opaque value and direct modifications and access are considered verboten.
Internal — key type used in Context.
Builds a new Local with the given default
to be returned
if a value hasn't been set, or after the local gets cleared.
Builds a new Local with the given default
to be returned
if a value hasn't been set, or after the local gets cleared.
val num = Local(0) num() //=> 0 num := 100 num() //=> 100 num.clear() num() //=> 0
Execute a block of code using the specified state of
Local.Context
and restore the current state when complete.
Execute a block of code with a clear state of Local.Context
and restore the current state when complete.
Clear the Local state.
Convert a closure () => R
into another closure of the same
type whose Local.Context is saved when calling closed
and restored upon invocation.
Return the state of the current Local state.
Restore the Local state to a given Context.