A ZLayer[E, A, B] describes how to build one or more services in your application. Services can be injected into effects via ZIO#provide. 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.
Attributes
- Companion
- object
- Source
- ZLayer.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Members list
Value members
Concrete methods
A symbolic alias for orDie.
Attributes
- Source
- ZLayer.scala
Combines this layer with the specified layer in parallel, producing a new layer that has the inputs and outputs of both.
Combines this layer with the specified layer in parallel, producing a new layer that has the inputs and outputs of both.
Attributes
- Source
- ZLayer.scala
Combines this layer with the specified layer sequentially, producing a new layer that has the inputs and outputs of both.
Combines this layer with the specified layer sequentially, producing a new layer that has the inputs and outputs of both.
Attributes
- Source
- ZLayer.scala
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 layers.
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 layers.
Attributes
- Source
- ZLayer.scala
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 layers.
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 layers.
Attributes
- Source
- ZLayer.scala
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 as well as any leftover inputs, and the outputs of 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 as well as any leftover inputs, and the outputs of the specified layer.
Attributes
- Source
- ZLayer.scala
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 as well as any leftover inputs, and the outputs of 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 as well as any leftover inputs, and the outputs of the specified layer.
Attributes
- Source
- ZLayer.scala
Returns a new layer that applies the specified aspect to this layer. Aspects are "transformers" that modify the behavior of their input in some well-defined way (for example, adding a timeout).
Returns a new layer that applies the specified aspect to this layer. Aspects are "transformers" that modify the behavior of their input in some well-defined way (for example, adding a timeout).
Attributes
- Source
- ZLayer.scala
A named alias for ++.
A named alias for >+>.
Provides an effect with part of its required environment, eliminating its dependency on the services output by this layer.
Provides an effect with part of its required environment, eliminating its dependency on the services output by this layer.
Attributes
- Source
- ZLayer.scala
Builds a layer into a scoped value.
Builds a layer into a ZIO value. Any resources associated with this layer will be released when the specified scope is closed unless their scope has been extended. This allows building layers where the lifetime of some of the services output by the layer exceed the lifetime of the effect the layer is provided to.
Builds a layer into a ZIO value. Any resources associated with this layer will be released when the specified scope is closed unless their scope has been extended. This allows building layers where the lifetime of some of the services output by the layer exceed the lifetime of the effect the layer is provided to.
Attributes
- Source
- ZLayer.scala
Recovers from all errors.
Recovers from all errors.
Taps the layer, printing the result of calling .toString on the value.
Taps the layer, printing the result of calling .toString on the value.
Attributes
- Source
- ZLayer.scala
Taps the layer, printing the result of calling .toString on the value. Prefixes the output with the given message.
Taps the layer, printing the result of calling .toString on the value. Prefixes the output with the given message.
Attributes
- Source
- ZLayer.scala
Extends the scope of this layer, returning a new layer that when provided to an effect will not immediately release its associated resources when that effect completes execution but instead when the scope the resulting effect depends on is closed.
Extends the scope of this layer, returning a new layer that when provided to an effect will not immediately release its associated resources when that effect completes execution but instead when the scope the resulting effect depends on is closed.
Attributes
- Source
- ZLayer.scala
Constructs a layer dynamically based on the output of this layer.
Returns a layer that performs the outer layer first, followed by the inner layer, yielding the value of the inner layer.
Returns a layer that performs the outer layer first, followed by the inner layer, yielding the value of the inner layer.
This method can be used to "flatten" nested layers.
Attributes
- Source
- ZLayer.scala
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.
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.
Attributes
- Source
- ZLayer.scala
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.
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.
Attributes
- Source
- ZLayer.scala
Creates a fresh version of this layer that will not be shared.
Returns the hash code of this layer.
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.
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.
Attributes
- Source
- ZLayer.scala
Returns a new layer whose output is mapped by the specified function.
Returns a new layer whose output is mapped by the specified function.
Attributes
- Source
- ZLayer.scala
Returns a layer with its error channel mapped using the specified function.
Returns a layer with its error channel mapped using the specified function.
Attributes
- Source
- ZLayer.scala
Returns a layer with its full cause of failure mapped using the specified function. This can be used to transform errors while preserving the original structure of Cause.
Returns a layer with its full cause of failure mapped using the specified function. This can be used to transform errors while preserving the original structure of Cause.
Attributes
- See also
- Source
- ZLayer.scala
Returns a scoped effect that, if evaluated, will return the lazily computed result of this layer.
Returns a scoped effect that, if evaluated, will return the lazily computed result of this layer.
Attributes
- Source
- ZLayer.scala
Translates effect failure into death of the fiber, making all failures unchecked and not a part of the type of the layer.
Translates effect failure into death of the fiber, making all failures unchecked and not a part of the type of the layer.
Attributes
- Source
- ZLayer.scala
Executes this layer and returns its output, if it succeeds, but otherwise executes the specified layer.
Executes this layer and returns its output, if it succeeds, but otherwise executes the specified layer.
Attributes
- Source
- ZLayer.scala
Returns a new layer that produces the outputs of this layer but also passes through the inputs.
Returns a new layer that produces the outputs of this layer but also passes through the inputs.
Attributes
- Source
- ZLayer.scala
Projects out part of one of the services output by this layer using the specified function.
Projects out part of one of the services output by this layer using the specified function.
Attributes
- Source
- ZLayer.scala
Returns a layer that produces a reloadable version of this service.
Returns a layer that produces a reloadable version of this service, where the reloading schedule is derived from the layer input.
Returns a layer that produces a reloadable version of this service, where the reloading schedule is derived from the layer input.
Attributes
- Source
- ZLayer.scala
Returns a layer that produces a reloadable version of this service.
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.
Performs the specified effect if this layer fails.
A named alias for >>>.
Converts a layer that requires no services into a scoped runtime, which can be used to execute effects.
Converts a layer that requires no services into a scoped runtime, which can be used to execute effects.
Attributes
- Source
- ZLayer.scala
Replaces the layer's output with Unit.
Replaces the layer's output with Unit.
When used with ZIO.provide and ZLayer.make macros (and their variants), this will suppress the unused layer warning that is normally emitted, and will actually include the layer for its side-effects.
Attributes
- Source
- ZLayer.scala
Updates one of the services output by this layer.
Combines this layer the specified layer sequentially, producing a new layer that has the inputs of both, and the outputs of both combined using the specified function.
Combines this layer the specified layer sequentially, producing a new layer that has the inputs of both, and the outputs of both combined using the specified function.
Attributes
- Source
- ZLayer.scala
Combines this layer the specified layer in parallel, producing a new layer that has the inputs of both, and the outputs of both combined using the specified function.
Combines this layer the specified layer in parallel, producing a new layer that has the inputs of both, and the outputs of both combined using the specified function.
Attributes
- Source
- ZLayer.scala
Inherited methods
Attributes
- Inherited from:
- ZLayerVersionSpecific (hidden)
- Source
- ZLayerVersionSpecific.scala