Class/Object

zio

ZLayer

Related Docs: object ZLayer | package zio

Permalink

sealed abstract class ZLayer[-RIn, +E, +ROut] extends AnyRef

A ZLayer[E, A, B] describes how to build one or more services in your application. Services can be injected into effects via ZIO#inject. Effects can require services via ZIO.service."

Layer can be thought of as recipes for producing bundles of services, given their dependencies (other services).

Construction of services 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]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ZLayer
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !(implicit ev1: <:<[E, Throwable], ev2: CanFail[E], trace: ZTraceElement): ZLayer[RIn, Nothing, ROut]

    Permalink

    A symbolic alias for orDie.

  2. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def +!+[E1 >: E, RIn2, ROut1 >: ROut, ROut2](that: ZLayer[RIn2, E1, ROut2]): ZLayer[RIn with RIn2, E1, ROut1 with ROut2]

    Permalink
  5. final def ++[E1 >: E, RIn2, ROut1 >: ROut, ROut2](that: ZLayer[RIn2, E1, ROut2])(implicit tag: zio.Tag[ROut2]): ZLayer[RIn with RIn2, E1, ROut1 with ROut2]

    Permalink

    Combines this layer with the specified layer, producing a new layer that has the inputs and outputs of = both.

  6. def <>[RIn1 <: RIn, E1, ROut1 >: ROut](that: ZLayer[RIn1, E1, ROut1])(implicit ev: CanFail[E], trace: ZTraceElement): ZLayer[RIn1, E1, ROut1]

    Permalink

    A symbolic alias for orElse.

  7. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. final def and[E1 >: E, RIn2, ROut1 >: ROut, ROut2](that: ZLayer[RIn2, E1, ROut2])(implicit tag: zio.Tag[ROut2]): ZLayer[RIn with RIn2, E1, ROut1 with ROut2]

    Permalink

    A named alias for ++.

  9. final def andTo[E1 >: E, RIn2 >: ROut, ROut1 >: ROut, ROut2](that: ZLayer[RIn2, E1, ROut2])(implicit tagged: zio.Tag[ROut2], trace: ZTraceElement): ZLayer[RIn, E1, ROut1 with ROut2]

    Permalink

    A named alias for >+>.

  10. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  11. final def build(implicit trace: ZTraceElement): ZManaged[RIn, E, ZEnvironment[ROut]]

    Permalink

    Builds a layer into a managed value.

  12. final def catchAll[RIn1 <: RIn, E1, ROut1 >: ROut](handler: (E) ⇒ ZLayer[RIn1, E1, ROut1])(implicit trace: ZTraceElement): ZLayer[RIn1, E1, ROut1]

    Permalink

    Recovers from all errors.

  13. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. final def flatMap[RIn1 <: RIn, E1 >: E, ROut2](f: (ZEnvironment[ROut]) ⇒ ZLayer[RIn1, E1, ROut2])(implicit trace: ZTraceElement): ZLayer[RIn1, E1, ROut2]

    Permalink

    Constructs a layer dynamically based on the output of this layer.

  18. final def flatten[RIn1 <: RIn, E1 >: E, ROut1 >: ROut, ROut2](implicit tag: zio.Tag[ROut1], ev1: <:<[ROut1, ZLayer[RIn1, E1, ROut2]], ev2: IsNotIntersection[ROut1], trace: ZTraceElement): ZLayer[RIn1, E1, ROut2]

    Permalink
  19. final def foldCauseServices[E1, RIn1 <: RIn, ROut2](failure: (Cause[E]) ⇒ ZLayer[RIn1, E1, ROut2], success: (ZEnvironment[ROut]) ⇒ ZLayer[RIn1, E1, ROut2])(implicit ev: CanFail[E]): ZLayer[RIn1, E1, ROut2]

    Permalink

    Feeds the error or output services of this layer into the input of either the specified failure or success layers, resulting in a new layer with the inputs of this layer, and the error or outputs of the specified layer.

  20. final def foldServices[E1, RIn1 <: RIn, ROut2](failure: (E) ⇒ ZLayer[RIn1, E1, ROut2], success: (ZEnvironment[ROut]) ⇒ ZLayer[RIn1, E1, ROut2])(implicit ev: CanFail[E], trace: ZTraceElement): ZLayer[RIn1, E1, ROut2]

    Permalink

    Feeds the error or output services of this layer into the input of either the specified failure or success layers, resulting in a new layer with the inputs of this layer, and the error or outputs of the specified layer.

  21. final def fresh: ZLayer[RIn, E, ROut]

    Permalink

    Creates a fresh version of this layer that will not be shared.

  22. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  23. final lazy val hashCode: Int

    Permalink

    Returns the hash code of this layer.

    Returns the hash code of this layer.

    Definition Classes
    ZLayer → AnyRef → Any
  24. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  25. final def launch(implicit trace: ZTraceElement): ZIO[RIn, E, Nothing]

    Permalink

    Builds this layer and uses it until it is interrupted.

    Builds this layer and uses it until it is interrupted. This is useful when your entire application is a layer, such as an HTTP server.

  26. final def map[ROut1](f: (ZEnvironment[ROut]) ⇒ ZEnvironment[ROut1])(implicit trace: ZTraceElement): ZLayer[RIn, E, ROut1]

    Permalink

    Returns a new layer whose output is mapped by the specified function.

  27. final def mapError[E1](f: (E) ⇒ E1)(implicit ev: CanFail[E], trace: ZTraceElement): ZLayer[RIn, E1, ROut]

    Permalink

    Returns a layer with its error channel mapped using the specified function.

  28. final def memoize(implicit trace: ZTraceElement): ZManaged[Any, Nothing, ZLayer[RIn, E, ROut]]

    Permalink

    Returns a managed effect that, if evaluated, will return the lazily computed result of this layer.

  29. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  30. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  31. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  32. final def orDie(implicit ev1: IsSubtypeOfError[E, Throwable], ev2: CanFail[E], trace: ZTraceElement): ZLayer[RIn, Nothing, ROut]

    Permalink

    Translates effect failure into death of the fiber, making all failures unchecked and not a part of the type of the layer.

  33. final def orElse[RIn1 <: RIn, E1, ROut1 >: ROut](that: ZLayer[RIn1, E1, ROut1])(implicit ev: CanFail[E], trace: ZTraceElement): ZLayer[RIn1, E1, ROut1]

    Permalink

    Executes this layer and returns its output, if it succeeds, but otherwise executes the specified layer.

  34. final def retry[RIn1 <: RIn with Clock](schedule: Schedule[RIn1, E, Any])(implicit trace: ZTraceElement): ZLayer[RIn1, E, ROut]

    Permalink

    Retries constructing this layer according to the specified schedule.

  35. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  36. final def tap[RIn1 <: RIn, E1 >: E](f: (ZEnvironment[ROut]) ⇒ ZIO[RIn1, E1, Any])(implicit trace: ZTraceElement): ZLayer[RIn1, E1, ROut]

    Permalink

    Performs the specified effect if this layer succeeds.

  37. final def tapError[RIn1 <: RIn, E1 >: E](f: (E) ⇒ ZIO[RIn1, E1, Any])(implicit trace: ZTraceElement): ZLayer[RIn1, E1, ROut]

    Permalink

    Performs the specified effect if this layer fails.

  38. final def to[E1 >: E, ROut2](that: ZLayer[ROut, E1, ROut2])(implicit trace: ZTraceElement): ZLayer[RIn, E1, ROut2]

    Permalink

    A named alias for >>>.

  39. final def toRuntime(runtimeConfig: RuntimeConfig)(implicit ev: <:<[Any, RIn], trace: ZTraceElement): Managed[E, Runtime[ROut]]

    Permalink

    Converts a layer that requires no services into a managed runtime, which can be used to execute effects.

  40. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  41. final def update[A >: ROut](f: (A) ⇒ A)(implicit arg0: zio.Tag[A], arg1: IsNotIntersection[A], trace: ZTraceElement): ZLayer[RIn, E, ROut]

    Permalink

    Updates one of the services output by this layer.

  42. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  44. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  45. final def zipWithPar[E1 >: E, RIn2, ROut1 >: ROut, ROut2, ROut3](that: ZLayer[RIn2, E1, ROut2])(f: (ZEnvironment[ROut], ZEnvironment[ROut2]) ⇒ ZEnvironment[ROut3]): ZLayer[RIn with RIn2, E1, ROut3]

    Permalink

    Combines this layer the specified layer, producing a new layer that has the inputs of both, and the outputs of both combined using the specified function.

Inherited from AnyRef

Inherited from Any

Ungrouped