- Companion:
- class
Type members
Classlikes
Value members
Concrete methods
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 using the specified state of
Local.Context
and restore the current state when complete.
The implementation uses the CanBindLocals
type class because in case of asynchronous data types that
should be waited on, like Future
or CompletableFuture
,
then the locals context also needs to be cleared on the
future's completion, for correctness.
There's no default instance for synchronous actions available
in scope. If you need to work with synchronous actions, you
need to import it explicitly:
import monix.execution.misc.CanBindLocals.Implicits.synchronousAsDefault
Execute a block of code with a clear 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.
The implementation uses the CanBindLocals
type class because in case of asynchronous data types that
should be waited on, like Future
or CompletableFuture
,
then the locals context also needs to be cleared on the
future's completion, for correctness.
There's no default instance for synchronous actions available
in scope. If you need to work with synchronous actions, you
need to import it explicitly:
import monix.execution.misc.CanBindLocals.Implicits.synchronousAsDefault
Convert a closure () => R
into another closure of the same
type whose Local.Context is saved when calling closed
and restored upon invocation.
Convert a closure () => R
into another closure of the same
type whose Local.Context is saved when calling closed
and restored upon invocation.
Execute a block of code without propagating any Local.Context
changes outside.
Execute a block of code without propagating any Local.Context
changes outside.
The implementation uses the CanBindLocals
type class because in case of asynchronous data types that
should be waited on, like Future
or CompletableFuture
,
then the locals context also needs to be cleared on the
future's completion, for correctness.
There's no default instance for synchronous actions available
in scope. If you need to work with synchronous actions, you
need to import it explicitly:
import monix.execution.misc.CanBindLocals.Implicits.synchronousAsDefault
Deprecated and Inherited methods
DEPRECATED — switch to local.closed[R: CanIsolate]
.
DEPRECATED — switch to local.closed[R: CanIsolate]
.
- Deprecated
[Since version 3.0.0]
- Inherited from:
- LocalCompanionDeprecated
DEPRECATED — switch to Local.newContext.
DEPRECATED — switch to Local.newContext.
- Deprecated
- Inherited from:
- LocalCompanionDeprecated