ZLayerCompanionVersionSpecific
zio.ZLayerCompanionVersionSpecific
Derives a simple layer for a case class given as a type parameter.
Derives a simple layer for a case class given as a type parameter.
case class Car(engine: Engine, wheels: Wheels)
val derivedLayer: ZLayer[Engine & Wheels, Nothing, Car] = ZLayer.deriveLayer[Car]
// equivalent to:
val manualLayer: ZLayer[Engine & Wheels, Nothing, Car] =
ZLayer.fromFunction(Car(_, _))
Automatically assembles a layer for the provided type.
Automatically assembles a layer for the provided type.
val layer = ZLayer.make[Car](carLayer, wheelsLayer, engineLayer)
Automatically assembles a layer for the provided type R
,
leaving a remainder R0
.
Automatically assembles a layer for the provided type R
,
leaving a remainder R0
.
val carLayer: ZLayer[Engine with Wheels, Nothing, Car] = ???
val wheelsLayer: ZLayer[Any, Nothing, Wheels] = ???
val layer = ZLayer.makeSome[Engine, Car](carLayer, wheelsLayer)