Default

zio.ZLayer.Derive.Default
See theDefault companion trait
object Default

Attributes

Companion
trait
Source
ZLayer.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Default.type

Members list

Type members

Classlikes

final implicit class ZLayerDefaultInvariantOps[R, E, A](self: WithContext[R, E, A]) extends AnyVal

Attributes

Source
ZLayer.scala
Supertypes
class AnyVal
trait Matchable
class Any

Types

type WithContext[R0, E0, A] = Default[A] { type R = R0; type E = E0; }

Attributes

Source
ZLayer.scala

Value members

Concrete methods

def apply[A](implicit ev: Default[A]): WithContext[ev.R, ev.E, A]

Summons the implicit default for the specified type.

Summons the implicit default for the specified type.

Attributes

Source
ZLayer.scala
def fromLayer[R0, E0, A : Tag](zlayer: => ZLayer[R0, E0, A])(implicit evidence$1: Tag[A], trace: Trace): WithContext[R0, E0, A]

Uses the provided layer as the default layer.

Uses the provided layer as the default layer.

Attributes

Source
ZLayer.scala
def fromZIO[R, E, A : Tag](zio: => ZIO[R, E, A])(implicit evidence$1: Tag[A], trace: Trace): WithContext[R, E, A]

Constructs a default layer using the provided ZIO value.

Constructs a default layer using the provided ZIO value.

Attributes

Source
ZLayer.scala
def service[A : Tag](implicit evidence$1: Tag[A], trace: Trace): WithContext[A, Nothing, A]

Makes a default value that requires the specified service from the environment.

Makes a default value that requires the specified service from the environment.

Used to discard a predefined Default instance for ZLayer.derive.

Attributes

Example
class Wheels(number: Int)
object Wheels {
 implicit val defaultWheels: ZLayer.Default.WithContext[Any, Nothing, Wheels] =
   ZLayer.Default.succeed(new Wheels(4))
}
class Car(wheels: Wheels)
val carLayer1: ULayer[Car] = ZLayer.derive // wheels.number == 4
val carLayer2: URLayer[Wheels, Car] = locally {
 // The default instance is discarded
 implicit val newWheels: ZLayer.Default.WithContext[Wheels, Nothing, Wheels] =
     ZLayer.Default.service[Wheels]
 ZLayer.derive[Car]
}
Source
ZLayer.scala
def succeed[A : Tag](a: => A)(implicit evidence$1: Tag[A], trace: Trace): WithContext[Any, Nothing, A]

Constructs a default layer using the provided value.

Constructs a default layer using the provided value.

Attributes

Source
ZLayer.scala

Implicits

Implicits

final implicit def ZLayerDefaultInvariantOps[R, E, A](self: WithContext[R, E, A]): ZLayerDefaultInvariantOps[R, E, A]

Attributes

Source
ZLayer.scala
implicit def deriveDefaultConfig[A : Tag](implicit evidence$1: Tag[A], ev: Config[A], trace: Trace): WithContext[Any, Error, A]

Attributes

Source
ZLayer.scala
implicit def deriveDefaultHub[A : Tag](implicit evidence$1: Tag[A], trace: Trace): WithContext[Any, Nothing, Hub[A]]

Attributes

Source
ZLayer.scala
implicit def deriveDefaultPromise[E : Tag, A : Tag](implicit evidence$1: Tag[E], evidence$2: Tag[A], trace: Trace): WithContext[Any, Nothing, Promise[E, A]]

Attributes

Source
ZLayer.scala
implicit def deriveDefaultQueue[A : Tag](implicit evidence$1: Tag[A], trace: Trace): WithContext[Any, Nothing, Queue[A]]

Attributes

Source
ZLayer.scala
implicit def deriveDefaultRef[A : Tag](implicit evidence$1: Tag[A], ev: Default[A], trace: Trace): WithContext[ev.R, ev.E, Ref[A]]

Attributes

Source
ZLayer.scala

Inherited implicits

implicit def defaultPromiseNothing[A : Tag](implicit evidence$1: Tag[A], trace: Trace): WithContext[Any, Nothing, Promise[Nothing, A]]

Attributes

Inherited from:
DefaultInstances0 (hidden)
Source
ZLayer.scala