object Local extends LocalCompanionDeprecated
- Source
- Local.scala
- Alphabetic
- By Inheritance
- Local
- LocalCompanionDeprecated
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- sealed abstract class Context extends AnyRef
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.
- final class Key extends Serializable
Internal — key type used in Context.
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def apply[A](default: A): Local[A]
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
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def bind[R](ctx: Context)(f: => R)(implicit R: CanBindLocals[R]): R
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
orCompletableFuture
, 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
- def bindClear[R](f: => R)(implicit R: CanBindLocals[R]): R
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
orCompletableFuture
, 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
- def clearContext(): Unit
Clear the Local state.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def closed[R](fn: () => R)(implicit R: CanBindLocals[R]): () => R
Convert a closure
() => R
into another closure of the same type whose Local.Context is saved when calling closed and restored upon invocation. - final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def getContext(): Context
Return the state of the current Local state.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isolate[R](f: => R)(implicit R: CanBindLocals[R]): R
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
orCompletableFuture
, 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
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def newContext(): Context
Creates a new, empty Context.
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def setContext(ctx: Context): Unit
Restore the Local state to a given Context.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def closed[R](fn: () => R): () => R
DEPRECATED — switch to
local.closed[R: CanIsolate]
.DEPRECATED — switch to
local.closed[R: CanIsolate]
.- Definition Classes
- LocalCompanionDeprecated
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Switch to local.closed[R: CanIsolate]
- def defaultContext(): Unbound
DEPRECATED — switch to Local.newContext.
DEPRECATED — switch to Local.newContext.
- Definition Classes
- LocalCompanionDeprecated
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Renamed to Local.newContext
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.
This is the API documentation for the Monix library.
Package Overview
monix.execution exposes lower level primitives for dealing with asynchronous execution:
Atomic
types, as alternative tojava.util.concurrent.atomic
monix.catnap exposes pure abstractions built on top of the Cats-Effect type classes:
monix.eval is for dealing with evaluation of results, thus exposing Task and Coeval.
monix.reactive exposes the
Observable
pattern:Observable
implementationsmonix.tail exposes Iterant for purely functional pull based streaming:
Batch
andBatchCursor
, the alternatives to Scala'sIterable
andIterator
respectively that we are using within Iterant's encodingYou can control evaluation with type you choose - be it Task, Coeval, cats.effect.IO or your own as long as you provide correct cats-effect or cats typeclass instance.