A ZManaged[R, E, A] is a managed resource of type A, which may be used by invoking the use method of the resource. The resource will be automatically acquired before the resource is used, and automatically released after the resource is used.
Resources do not survive the scope of use, meaning that if you attempt to capture the resource, leak it from use, and then use it after the resource has been consumed, the resource will not be valid anymore and may fail with some checked error, as per the type of the functions provided by the resource.
Attributes
- Companion
- object
- Source
- ZManaged.scala
- Graph
-
- Supertypes
-
trait Serializableclass Objecttrait Matchableclass Any
- Self type
-
Members list
Value members
Abstract methods
The ZIO value that underlies this ZManaged value. To evaluate it, a ReleaseMap is required. The ZIO value will return a tuple of the resource allocated by this ZManaged and a finalizer that will release the resource.
The ZIO value that underlies this ZManaged value. To evaluate it, a ReleaseMap is required. The ZIO value will return a tuple of the resource allocated by this ZManaged and a finalizer that will release the resource.
Note that this method is a low-level interface, not intended for regular usage. As such, it offers no guarantees on interruption or resource safety
- those are up to the caller to enforce!
Attributes
- Source
- ZManaged.scala
Concrete methods
A symbolic alias for orDie.
Symbolic alias for zipParRight
Symbolic alias for zipRight
Symbolic alias for zipParLeft
Symbolic alias for zipPar
Symbolic alias for zipLeft.
Symbolic alias for zip.
Operator alias for orElse.
Syntax for adding aspects.
Submerges the error case of an Either into the ZManaged. The inverse operation of ZManaged.either.
Submerges the error case of an Either into the ZManaged. The inverse operation of ZManaged.either.
Attributes
- Source
- ZManaged.scala
Attempts to convert defects into a failure, throwing away all information about the cause of the failure.
Attempts to convert defects into a failure, throwing away all information about the cause of the failure.
Attributes
- Source
- ZManaged.scala
Attempts to convert defects into a failure, throwing away all information about the cause of the failure.
Attempts to convert defects into a failure, throwing away all information about the cause of the failure.
Attributes
- Source
- ZManaged.scala
Maps this effect to the specified constant while preserving the effects of this effect.
Maps this effect to the specified constant while preserving the effects of this effect.
Attributes
- Source
- ZManaged.scala
Maps the success value of this effect to an optional value.
Maps the error value of this effect to an optional value.
Recovers from all errors.
Recovers from all errors with provided Cause.
Recovers from all errors with provided Cause.
managed.catchAllCause(_ => ZManaged.succeed(defaultConfig))
Attributes
- See also
-
absorb, sandbox, mapErrorCause - other functions that can recover from defects
- Source
- ZManaged.scala
Recovers from some or all of the error cases.
Recovers from some or all of the error Causes.
Fail with e if the supplied PartialFunction does not match, otherwise succeed with the returned value.
Fail with e if the supplied PartialFunction does not match, otherwise succeed with the returned value.
Attributes
- Source
- ZManaged.scala
Fail with e if the supplied PartialFunction does not match, otherwise continue with the returned value.
Fail with e if the supplied PartialFunction does not match, otherwise continue with the returned value.
Attributes
- Source
- ZManaged.scala
Returns an effect whose failure and success have been lifted into an Either.The resulting effect cannot fail
Returns an effect whose failure and success have been lifted into an Either.The resulting effect cannot fail
Attributes
- Source
- ZManaged.scala
Ensures that f is executed when this ZManaged is finalized, after the existing finalizer.
Ensures that f is executed when this ZManaged is finalized, after the existing finalizer.
For usecases that need access to the ZManaged's result, see ZManaged#onExit.
Attributes
- Source
- ZManaged.scala
Ensures that f is executed when this ZManaged is finalized, before the existing finalizer.
Ensures that f is executed when this ZManaged is finalized, before the existing finalizer.
For usecases that need access to the ZManaged's result, see ZManaged#onExitFirst.
Attributes
- Source
- ZManaged.scala
Returns a ZManaged that ignores errors raised by the acquire effect and runs it repeatedly until it eventually succeeds.
Returns a ZManaged that ignores errors raised by the acquire effect and runs it repeatedly until it eventually succeeds.
Attributes
- Source
- ZManaged.scala
Returns an effect that semantically runs the effect on a fiber, producing an zio.Exit for the completion value of the fiber.
Returns an effect that semantically runs the effect on a fiber, producing an zio.Exit for the completion value of the fiber.
Attributes
- Source
- ZManaged.scala
Returns a managed resource that attempts to acquire this managed resource and in case of failure, attempts to acquire each of the specified managed resources in order until one of them is successfully acquired, ensuring that the acquired resource is properly released after being used.
Returns a managed resource that attempts to acquire this managed resource and in case of failure, attempts to acquire each of the specified managed resources in order until one of them is successfully acquired, ensuring that the acquired resource is properly released after being used.
Attributes
- Source
- ZManaged.scala
Returns an effect that models the execution of this effect, followed by the passing of its value to the specified continuation function k, followed by the effect that it returns.
Returns an effect that models the execution of this effect, followed by the passing of its value to the specified continuation function k, followed by the effect that it returns.
Attributes
- Source
- ZManaged.scala
Effectfully map the error channel
Returns an effect that performs the outer effect first, followed by the inner effect, yielding the value of the inner effect.
Returns an effect that performs the outer effect first, followed by the inner effect, yielding the value of the inner effect.
This method can be used to "flatten" nested effects.
Attributes
- Source
- ZManaged.scala
Returns an effect that performs the outer effect first, followed by the inner effect, yielding the value of the inner effect.
Returns an effect that performs the outer effect first, followed by the inner effect, yielding the value of the inner effect.
This method can be used to "flatten" nested effects.
Attributes
- Source
- ZManaged.scala
Flip the error and result
Flip the error and result, then apply an effectful function to the effect
Flip the error and result, then apply an effectful function to the effect
Attributes
- Source
- ZManaged.scala
Folds over the failure value or the success value to yield an effect that does not fail, but succeeds with the value returned by the left or right function passed to fold.
Folds over the failure value or the success value to yield an effect that does not fail, but succeeds with the value returned by the left or right function passed to fold.
Attributes
- Source
- ZManaged.scala
A more powerful version of fold that allows recovering from any kind of failure except interruptions.
A more powerful version of fold that allows recovering from any kind of failure except interruptions.
Attributes
- Source
- ZManaged.scala
A more powerful version of foldManaged that allows recovering from any kind of failure except interruptions.
A more powerful version of foldManaged that allows recovering from any kind of failure except interruptions.
Attributes
- Source
- ZManaged.scala
Recovers from errors by accepting one effect to execute for the case of an error, and one effect to execute for the case of success.
Recovers from errors by accepting one effect to execute for the case of an error, and one effect to execute for the case of success.
Attributes
- Source
- ZManaged.scala
Creates a ZManaged value that acquires the original resource in a fiber, and provides that fiber. The finalizer for this value will interrupt the fiber and run the original finalizer.
Creates a ZManaged value that acquires the original resource in a fiber, and provides that fiber. The finalizer for this value will interrupt the fiber and run the original finalizer.
Attributes
- Source
- ZManaged.scala
Returns a new effect that ignores the success or failure of this effect.
Returns a new effect that ignores the success or failure of this effect.
Attributes
- Source
- ZManaged.scala
Returns a new managed effect that ignores defects in finalizers.
Returns whether this managed effect is a failure.
Returns whether this managed effect is a success.
Returns an effect whose success is mapped by the specified f function.
Returns an effect whose success is mapped by the specified f function.
Attributes
- Source
- ZManaged.scala
Returns an effect whose success is mapped by the specified side effecting f function, translating any thrown exceptions into typed failed effects.
Returns an effect whose success is mapped by the specified side effecting f function, translating any thrown exceptions into typed failed effects.
Attributes
- Source
- ZManaged.scala
Returns an effect whose failure and success channels have been mapped by the specified pair of functions, f and g.
Returns an effect whose failure and success channels have been mapped by the specified pair of functions, f and g.
Attributes
- Source
- ZManaged.scala
Returns an effect whose failure is mapped by the specified f function.
Returns an effect whose failure is mapped by the specified f function.
Attributes
- Source
- ZManaged.scala
Returns an effect whose full failure is mapped by the specified f function.
Returns an effect whose full failure is mapped by the specified f function.
Attributes
- Source
- ZManaged.scala
Effectfully maps the resource acquired by this value.
Attributes
- Source
- ZManaged.scala
Returns a new effect where the error channel has been merged into the success channel to their common combined type.
Returns a new effect where the error channel has been merged into the success channel to their common combined type.
Attributes
- Source
- ZManaged.scala
Requires the option produced by this value to be None.
Runs this managed effect, as well as any managed effects that are composed sequentially after it, using the specified ExecutionContext.
Runs this managed effect, as well as any managed effects that are composed sequentially after it, using the specified ExecutionContext.
Attributes
- Source
- ZManaged.scala
Locks this managed effect to the specified executor, guaranteeing that this managed effect as well as managed effects that are composed sequentially after it will be run on the specified executor.
Locks this managed effect to the specified executor, guaranteeing that this managed effect as well as managed effects that are composed sequentially after it will be run on the specified executor.
Attributes
- Source
- ZManaged.scala
Ensures that a cleanup function runs when this ZManaged is finalized, after the existing finalizers.
Ensures that a cleanup function runs when this ZManaged is finalized, after the existing finalizers.
Attributes
- Source
- ZManaged.scala
Ensures that a cleanup function runs when this ZManaged is finalized, before the existing finalizers.
Ensures that a cleanup function runs when this ZManaged is finalized, before the existing finalizers.
Attributes
- Source
- ZManaged.scala
Executes this effect, skipping the error but returning optionally the success.
Executes this effect, skipping the error but returning optionally the success.
Attributes
- Source
- ZManaged.scala
Translates effect failure into death of the fiber, making all failures unchecked and not a part of the type of the effect.
Translates effect failure into death of the fiber, making all failures unchecked and not a part of the type of the effect.
Attributes
- Source
- ZManaged.scala
Keeps none of the errors, and terminates the fiber with them, using the specified function to convert the E into a Throwable.
Keeps none of the errors, and terminates the fiber with them, using the specified function to convert the E into a Throwable.
Attributes
- Source
- ZManaged.scala
Executes this effect and returns its value, if it succeeds, but otherwise executes the specified effect.
Executes this effect and returns its value, if it succeeds, but otherwise executes the specified effect.
Attributes
- Source
- ZManaged.scala
Returns an effect that will produce the value of this effect, unless it fails, in which case, it will produce the value of the specified effect.
Returns an effect that will produce the value of this effect, unless it fails, in which case, it will produce the value of the specified effect.
Attributes
- Source
- ZManaged.scala
Executes this effect and returns its value, if it succeeds, but otherwise fails with the specified error.
Executes this effect and returns its value, if it succeeds, but otherwise fails with the specified error.
Attributes
- Source
- ZManaged.scala
Returns an effect that will produce the value of this effect, unless it fails with the None value, in which case it will produce the value of the specified effect.
Returns an effect that will produce the value of this effect, unless it fails with the None value, in which case it will produce the value of the specified effect.
Attributes
- Source
- ZManaged.scala
Executes this effect and returns its value, if it succeeds, but otherwise succeeds with the specified value.
Executes this effect and returns its value, if it succeeds, but otherwise succeeds with the specified value.
Attributes
- Source
- ZManaged.scala
Preallocates the managed resource, resulting in a ZManaged that reserves and acquires immediately and cannot fail. You should take care that you are not interrupted between running preallocate and actually acquiring the resource as you might leak otherwise.
Preallocates the managed resource, resulting in a ZManaged that reserves and acquires immediately and cannot fail. You should take care that you are not interrupted between running preallocate and actually acquiring the resource as you might leak otherwise.
Attributes
- Source
- ZManaged.scala
Preallocates the managed resource inside an outer managed, resulting in a ZManaged that reserves and acquires immediately and cannot fail.
Preallocates the managed resource inside an outer managed, resulting in a ZManaged that reserves and acquires immediately and cannot fail.
Attributes
- Source
- ZManaged.scala
Provides the ZManaged effect with its required environment, which eliminates its dependency on R.
Provides the ZManaged effect with its required environment, which eliminates its dependency on R.
Attributes
- Source
- ZManaged.scala
Provides a layer to the ZManaged, which translates it to another level.
Provides a layer to the ZManaged, which translates it to another level.
Attributes
- Source
- ZManaged.scala
Transforms the environment being provided to this effect with the specified function.
Transforms the environment being provided to this effect with the specified function.
Attributes
- Source
- ZManaged.scala
Splits the environment into two parts, providing one part using the specified layer and leaving the remainder R0.
Splits the environment into two parts, providing one part using the specified layer and leaving the remainder R0.
val loggingLayer: ZLayer[Any, Nothing, Logging] = ???
val managed: ZManaged[Logging with Database, Nothing, Unit] = ???
val managed2 = managed.provideSomeLayer[Database](loggingLayer)
Attributes
- Source
- ZManaged.scala
Keeps some of the errors, and terminates the fiber with the rest.
Keeps some of the errors, and terminates the fiber with the rest, using the specified function to convert the E into a Throwable.
Keeps some of the errors, and terminates the fiber with the rest, using the specified function to convert the E into a Throwable.
Attributes
- Source
- ZManaged.scala
Keeps some of the errors, and terminates the fiber with the rest.
Fail with the returned value if the PartialFunction matches, otherwise continue with our held value.
Fail with the returned value if the PartialFunction matches, otherwise continue with our held value.
Attributes
- Source
- ZManaged.scala
Continue with the returned computation if the PartialFunction matches, translating the successful match into a failure, otherwise continue with our held value.
Continue with the returned computation if the PartialFunction matches, translating the successful match into a failure, otherwise continue with our held value.
Attributes
- Source
- ZManaged.scala
Runs all the finalizers associated with this scope. This is useful to conceptually "close" a scope when composing multiple managed effects. Note that this is only safe if the result of this managed effect is valid outside its scope.
Runs all the finalizers associated with this scope. This is useful to conceptually "close" a scope when composing multiple managed effects. Note that this is only safe if the result of this managed effect is valid outside its scope.
Attributes
- Source
- ZManaged.scala
Returns a Reservation that allows separately accessing effects describing resource acquisition and release.
Returns a Reservation that allows separately accessing effects describing resource acquisition and release.
Attributes
- Source
- ZManaged.scala
Retries with the specified retry policy. Retries are done following the failure of the original io (up to a fixed maximum with once or recurs for example), so that that io.retry(Schedule.once) means "execute io and in case of failure, try again once".
Retries with the specified retry policy. Retries are done following the failure of the original io (up to a fixed maximum with once or recurs for example), so that that io.retry(Schedule.once) means "execute io and in case of failure, try again once".
Attributes
- Source
- ZManaged.scala
Exposes the full cause of failure of this effect.
Companion helper to sandbox. Allows recovery, and partial recovery, from errors and defects alike.
Companion helper to sandbox. Allows recovery, and partial recovery, from errors and defects alike.
Attributes
- Source
- ZManaged.scala
Attributes
- Source
- ZManaged.scala
Converts an option on values into an option on errors.
Extracts the optional value, or returns the given 'default'.
Extracts the optional value, or executes the effect 'default'.
Extracts the optional value, or fails with the given error 'e'.
Extracts the optional value, or fails with a java.util.NoSuchElementException
Extracts the optional value, or fails with a java.util.NoSuchElementException
Attributes
- Source
- ZManaged.scala
Returns an effect that effectfully peeks at the acquired resource.
Returns an effect that effectfully peeks at the failure or success of the acquired resource.
Returns an effect that effectfully peeks at the failure or success of the acquired resource.
Attributes
- Source
- ZManaged.scala
Returns an effect that effectually "peeks" at the defect of the acquired resource.
Returns an effect that effectually "peeks" at the defect of the acquired resource.
Attributes
- Source
- ZManaged.scala
Returns an effect that effectfully peeks at the failure of the acquired resource.
Returns an effect that effectfully peeks at the failure of the acquired resource.
Attributes
- Source
- ZManaged.scala
Returns an effect that effectually peeks at the cause of the failure of the acquired resource.
Returns an effect that effectually peeks at the cause of the failure of the acquired resource.
Attributes
- Source
- ZManaged.scala
Like ZManaged#tap, but uses a function that returns a ZIO value rather than a ZManaged value.
Like ZManaged#tap, but uses a function that returns a ZIO value rather than a ZManaged value.
Attributes
- Source
- ZManaged.scala
Returns a new effect that executes this one and times the acquisition of the resource.
Returns a new effect that executes this one and times the acquisition of the resource.
Attributes
- Source
- ZManaged.scala
Returns an effect that will timeout this resource, returning None if the timeout elapses before the resource was reserved and acquired. If the reservation completes successfully (even after the timeout) the release action will be run on a new fiber. Some will be returned if acquisition and reservation complete in time
Returns an effect that will timeout this resource, returning None if the timeout elapses before the resource was reserved and acquired. If the reservation completes successfully (even after the timeout) the release action will be run on a new fiber. Some will be returned if acquisition and reservation complete in time
Attributes
- Source
- ZManaged.scala
Constructs a layer from this managed resource.
Constructs a layer from this managed resource, which must return one or more services.
Constructs a layer from this managed resource, which must return one or more services.
Attributes
- Source
- ZManaged.scala
Return unit while running the effect
The moral equivalent of if (!p) exp
The moral equivalent of if (!p) exp when p has side-effects
The inverse operation ZManaged.sandboxed
Converts an option on errors into an option on values.
Updates a service in the environment of this effect.
Updates a service at the specified key in the environment of this effect.
Updates a service at the specified key in the environment of this effect.
Attributes
- Source
- ZManaged.scala
Run an effect while acquiring the resource before and releasing it after
Run an effect while acquiring the resource before and releasing it after
Attributes
- Source
- ZManaged.scala
Run an effect while acquiring the resource before and releasing it after. This does not provide the resource to the function
Run an effect while acquiring the resource before and releasing it after. This does not provide the resource to the function
Attributes
- Source
- ZManaged.scala
Use the resource until interruption. Useful for resources that you want to acquire and use as long as the application is running, like a HTTP server.
Use the resource until interruption. Useful for resources that you want to acquire and use as long as the application is running, like a HTTP server.
Attributes
- Source
- ZManaged.scala
Runs the acquire and release actions and returns the result of this managed effect. Note that this is only safe if the result of this managed effect is valid outside its scope.
Runs the acquire and release actions and returns the result of this managed effect. Note that this is only safe if the result of this managed effect is valid outside its scope.
Attributes
- Source
- ZManaged.scala
The moral equivalent of if (p) exp
The moral equivalent of if (p) exp when p has side-effects
Modifies this ZManaged to provide a canceler that can be used to eagerly execute the finalizer of this ZManaged. The canceler will run uninterruptibly with an exit value indicating that the effect was interrupted, and if completed will cause the regular finalizer to not run.
Modifies this ZManaged to provide a canceler that can be used to eagerly execute the finalizer of this ZManaged. The canceler will run uninterruptibly with an exit value indicating that the effect was interrupted, and if completed will cause the regular finalizer to not run.
Attributes
- Source
- ZManaged.scala
A more powerful version of withEarlyRelease that allows specifying an exit value in the event of early release.
A more powerful version of withEarlyRelease that allows specifying an exit value in the event of early release.
Attributes
- Source
- ZManaged.scala
Runs this managed effect with the specified maximum number of fibers for parallel operators, guaranteeing that this managed effect as well as managed effects that are composed sequentially after it will be run with the specified maximum number of fibers for parallel operators.
Runs this managed effect with the specified maximum number of fibers for parallel operators, guaranteeing that this managed effect as well as managed effects that are composed sequentially after it will be run with the specified maximum number of fibers for parallel operators.
Attributes
- Source
- ZManaged.scala
Runs this managed effect with an unbounded maximum number of fibers for parallel operators, guaranteeing that this managed effect as well as managed effects that are composed sequentially after it will be run with an unbounded maximum number of fibers for parallel operators.
Runs this managed effect with an unbounded maximum number of fibers for parallel operators, guaranteeing that this managed effect as well as managed effects that are composed sequentially after it will be run with an unbounded maximum number of fibers for parallel operators.
Attributes
- Source
- ZManaged.scala
Named alias for ``.
Named alias for <*.
Named alias for ``.
Named alias for <&.
Named alias for &>.
Named alias for *>.
Returns an effect that executes both this effect and the specified effect, in sequence, combining their results with the specified f function.
Returns an effect that executes both this effect and the specified effect, in sequence, combining their results with the specified f function.
Attributes
- Source
- ZManaged.scala
Returns an effect that executes both this effect and the specified effect, in parallel, combining their results with the specified f function. If either side fails, then the other side will be interrupted.
Returns an effect that executes both this effect and the specified effect, in parallel, combining their results with the specified f function. If either side fails, then the other side will be interrupted.
Attributes
- Source
- ZManaged.scala
Inherited methods
Automatically assembles a layer for the ZManaged effect, which translates it to another level.
Automatically assembles a layer for the ZManaged effect, which translates it to another level.
Attributes
- Inherited from:
- ZManagedVersionSpecific (hidden)
- Source
- ZManagedVersionSpecific.scala
Splits the environment into two parts, assembling one part using the specified layer and leaving the remainder R0.
Splits the environment into two parts, assembling one part using the specified layer and leaving the remainder R0.
val clockLayer: ZLayer[Any, Nothing, Clock] = ???
val managed: ZIO[Clock with Random, Nothing, Unit] = ???
val managed2 = managed.provideSome[Random](clockLayer)
Attributes
- Inherited from:
- ZManagedVersionSpecific (hidden)
- Source
- ZManagedVersionSpecific.scala