Combines this layer with the specified layer, producing a new layer that has the inputs of both layers, and the outputs of both layers.
A symbolic alias for zipPar
.
A symbolic alias for orElse
.
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 both this layer and the specified layer.
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.
A named alias for ++
.
A named alias for >+>
.
Builds a layer into a managed value.
Recovers from all errors.
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.
Creates a fresh version of this layer that will not be shared.
Returns the hash code of this layer.
Returns the hash code of this layer.
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.
Returns a new layer whose output is mapped by the specified function.
Returns a layer with its error channel mapped using the specified function.
Returns a managed effect that, if evaluated, will return the lazily computed result of this layer.
Translates effect failure into death of the fiber, making all failures unchecked and not a part of the type of the layer.
Executes this layer and returns its output, if it succeeds, but otherwise executes the specified layer.
Retries constructing this layer according to the specified schedule.
Performs the specified effect if this layer succeeds.
Performs the specified effect if this layer fails.
A named alias for >>>
.
Converts a layer that requires no services into a managed runtime, which can be used to execute effects.
Updates one of the services output by this layer.
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 into a tuple.
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.
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.