final class ZLayer[-RIn, +E, +ROut] extends AnyRef
A ZLayer[A, E, B]
describes a layer of an application: every layer in an
application requires some services (the input) and produces some services
(the output).
Layers can be thought of as recipes for producing bundles of services, given their dependencies (other services).
Construction of layers can be effectful and utilize resources that must be acquired and safely released when the services are done being utilized.
By default layers are shared, meaning that if the same layer is used twice the layer will only be allocated a single time.
Because of their excellent composition properties, layers are the idiomatic way in ZIO to create services that depend on other services.
- Self Type
- ZLayer[RIn, E, ROut]
- Alphabetic
- By Inheritance
- ZLayer
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
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 >>>[E1 >: E, ROut2](that: ZLayer[ROut, E1, ROut2]): ZLayer[RIn, E1, ROut2]
Feeds the output services of this layer into the input of the specified layer, resulting in a new layer with the inputs of this layer, and the outputs of the specified layer.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def build: ZManaged[RIn, E, ROut]
Builds a layer into a managed value.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def fold[E1, ROut2](failure: ZLayer[Cause[E], E1, ROut2], success: ZLayer[ROut, E1, ROut2])(implicit ev: CanFail[E]): ZLayer[RIn, E1, ROut2]
Feeds the error or output services of this layer into the input of either the specified
failure
orsuccess
layers, resulting in a new layer with the inputs of this layer, and the error or outputs of the specified layer. - def fresh: ZLayer[RIn, E, ROut]
Creates a fresh version of this layer that will not be shared.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def map[ROut1](f: (ROut) => ROut1): ZLayer[RIn, E, ROut1]
Returns a new layer whose output is mapped by the specified function.
- def mapError[E1](f: (E) => E1)(implicit ev: CanFail[E]): ZLayer[RIn, E1, ROut]
Returns a layer with its error channel mapped using the specified function.
- def memoize: ZManaged[Any, Nothing, ZLayer[RIn, E, ROut]]
Returns a managed effect that, if evaluated, will return the lazily computed result of this layer.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def orDie(implicit ev1: <:<[E, Throwable], ev2: CanFail[E]): ZLayer[RIn, Nothing, ROut]
Translates effect failure into death of the fiber, making all failures unchecked and not a part of the type of the layer.
- def orElse[RIn1 <: RIn, E1, ROut1 >: ROut](that: => ZLayer[RIn1, E1, ROut1])(implicit ev: CanFail[E]): ZLayer[RIn1, E1, ROut1]
Executes this layer and returns its output, if it succeeds, but otherwise executes the specified layer.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toRuntime(p: Platform)(implicit ev: <:<[Any, RIn]): Managed[E, Runtime[ROut]]
Converts a layer that requires no services into a managed runtime, which can be used to execute effects.
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- 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()
- def zipWithPar[E1 >: E, RIn2, ROut1 >: ROut, ROut2, ROut3](that: ZLayer[RIn2, E1, ROut2])(f: (ROut, ROut2) => ROut3): ZLayer[RIn with RIn2, E1, ROut3]
Combines this layer with the specified layer, producing a new layer that has the inputs of both layers, and the outputs of both layers combined using the specified function.