Layer<E, Service> class

A Layer can be used to construct a service.

It will only be built once per ZIO execution, or it can be provided to a Runtime using Runtime.provideLayer.

If it is provided to a Runtime, it will be built once per Runtime - being reused for all ZIO executions.

It can be accessed using access or accessWith. Or by calling ZIO.layer.

You can also replace a Layer using Layer.replace.

Constructors

Layer(EIO<E, Service> make)
A Layer constructs a service, and is only built once per ZIO execution.
factory
Layer.scoped(ZIO<Scope<NoEnv>, E, Service> make)
A Layer that has scoped resources.
factory

Properties

access EIO<E, Service>
no setter
atom FutureAtom<Service>
latefinal
atomSyncOnly ReadOnlyAtom<Service>
latefinal
build ZIO<Scope<NoEnv>, E, Service>
no setter
buildContext EIO<E, LayerContext>
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tag Symbol
final

Methods

accessWith<A>(A f(Service _)) EIO<E, A>
accessWithZIO<R, A>(ZIO<R, E, A> f(Service _)) ZIO<R, E, A>
mapError<E2>(E2 f(E _)) Layer<E2, Service>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
provideLayer(Layer<E, dynamic> layer) Layer<E, Service>
replace<E2>(EIO<E2, Service> build) Layer<E2, Service>
replaceScoped<E2>(ZIO<Scope<NoEnv>, E2, Service> build) Layer<E2, Service>
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited