Class/Object

zio.managed

ZManaged

Related Docs: object ZManaged | package managed

Permalink

sealed abstract class ZManaged[-R, +E, +A] extends ZManagedVersionSpecific[R, E, A] with Serializable

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.

Self Type
ZManaged[R, E, A]
Linear Supertypes
Serializable, Serializable, ZManagedVersionSpecific[R, E, A], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ZManaged
  2. Serializable
  3. Serializable
  4. ZManagedVersionSpecific
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def zio: ZIO[R, E, (Finalizer, A)]

    Permalink

    The ZIO value that underlies this ZManaged value.

    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!

Concrete Value Members

  1. final def !(implicit ev1: <:<[E, Throwable], ev2: CanFail[E], trace: ZTraceElement): ZManaged[R, Nothing, A]

    Permalink

    A symbolic alias for orDie.

  2. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  4. def &>[R1 <: R, E1 >: E, A1](that: ⇒ ZManaged[R1, E1, A1])(implicit trace: ZTraceElement): ZManaged[R1, E1, A1]

    Permalink

    Symbolic alias for zipParRight

  5. def *>[R1 <: R, E1 >: E, A1](that: ⇒ ZManaged[R1, E1, A1])(implicit trace: ZTraceElement): ZManaged[R1, E1, A1]

    Permalink

    Symbolic alias for zipRight

  6. def <&[R1 <: R, E1 >: E, A1](that: ⇒ ZManaged[R1, E1, A1])(implicit trace: ZTraceElement): ZManaged[R1, E1, A]

    Permalink

    Symbolic alias for zipParLeft

  7. def <&>[R1 <: R, E1 >: E, A1](that: ⇒ ZManaged[R1, E1, A1])(implicit zippable: Zippable[A, A1], trace: ZTraceElement): ZManaged[R1, E1, Out]

    Permalink

    Symbolic alias for zipPar

  8. def <*[R1 <: R, E1 >: E, A1](that: ⇒ ZManaged[R1, E1, A1])(implicit trace: ZTraceElement): ZManaged[R1, E1, A]

    Permalink

    Symbolic alias for zipLeft.

  9. def <*>[R1 <: R, E1 >: E, A1](that: ⇒ ZManaged[R1, E1, A1])(implicit zippable: Zippable[A, A1], trace: ZTraceElement): ZManaged[R1, E1, Out]

    Permalink

    Symbolic alias for zip.

  10. def <>[R1 <: R, E2, A1 >: A](that: ⇒ ZManaged[R1, E2, A1])(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R1, E2, A1]

    Permalink

    Operator alias for orElse.

  11. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  12. final def @@[LowerR <: UpperR, UpperR <: R, LowerE >: E, UpperE >: LowerE, LowerA >: A, UpperA >: LowerA](aspect: ⇒ ZManagedAspect[LowerR, UpperR, LowerE, UpperE, LowerA, UpperA])(implicit trace: ZTraceElement): ZManaged[UpperR, LowerE, LowerA]

    Permalink

    Syntax for adding aspects.

  13. def absolve[E1 >: E, B](implicit ev: IsSubtypeOfOutput[A, Either[E1, B]], trace: ZTraceElement): ZManaged[R, E1, B]

    Permalink

    Submerges the error case of an Either into the ZManaged.

    Submerges the error case of an Either into the ZManaged. The inverse operation of ZManaged.either.

  14. def absorb(implicit ev: IsSubtypeOfError[E, Throwable], trace: ZTraceElement): ZManaged[R, Throwable, A]

    Permalink

    Attempts to convert defects into a failure, throwing away all information about the cause of the failure.

  15. def absorbWith(f: (E) ⇒ Throwable)(implicit trace: ZTraceElement): ZManaged[R, Throwable, A]

    Permalink

    Attempts to convert defects into a failure, throwing away all information about the cause of the failure.

  16. def as[B](b: ⇒ B)(implicit trace: ZTraceElement): ZManaged[R, E, B]

    Permalink

    Maps this effect to the specified constant while preserving the effects of this effect.

  17. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  18. final def asSome(implicit trace: ZTraceElement): ZManaged[R, E, Option[A]]

    Permalink

    Maps the success value of this effect to an optional value.

  19. final def asSomeError(implicit trace: ZTraceElement): ZManaged[R, Option[E], A]

    Permalink

    Maps the error value of this effect to an optional value.

  20. def catchAll[R1 <: R, E2, A1 >: A](h: (E) ⇒ ZManaged[R1, E2, A1])(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R1, E2, A1]

    Permalink

    Recovers from all errors.

  21. def catchAllCause[R1 <: R, E2, A1 >: A](h: (Cause[E]) ⇒ ZManaged[R1, E2, A1])(implicit trace: ZTraceElement): ZManaged[R1, E2, A1]

    Permalink

    Recovers from all errors with provided Cause.

    Recovers from all errors with provided Cause.

    managed.catchAllCause(_ => ZManaged.succeed(defaultConfig))
    See also

    absorb, sandbox, mapErrorCause - other functions that can recover from defects

  22. def catchSome[R1 <: R, E1 >: E, A1 >: A](pf: PartialFunction[E, ZManaged[R1, E1, A1]])(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R1, E1, A1]

    Permalink

    Recovers from some or all of the error cases.

  23. def catchSomeCause[R1 <: R, E1 >: E, A1 >: A](pf: PartialFunction[Cause[E], ZManaged[R1, E1, A1]])(implicit trace: ZTraceElement): ZManaged[R1, E1, A1]

    Permalink

    Recovers from some or all of the error Causes.

  24. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. def collect[E1 >: E, B](e: ⇒ E1)(pf: PartialFunction[A, B])(implicit trace: ZTraceElement): ZManaged[R, E1, B]

    Permalink

    Fail with e if the supplied PartialFunction does not match, otherwise succeed with the returned value.

  26. def collectManaged[R1 <: R, E1 >: E, B](e: ⇒ E1)(pf: PartialFunction[A, ZManaged[R1, E1, B]])(implicit trace: ZTraceElement): ZManaged[R1, E1, B]

    Permalink

    Fail with e if the supplied PartialFunction does not match, otherwise continue with the returned value.

  27. def either(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R, Nothing, Either[E, A]]

    Permalink

    Returns an effect whose failure and success have been lifted into an Either.The resulting effect cannot fail

  28. def ensuring[R1 <: R](f: ⇒ ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZManaged[R1, E, A]

    Permalink

    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.

  29. def ensuringFirst[R1 <: R](f: ⇒ ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZManaged[R1, E, A]

    Permalink

    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.

  30. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  31. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  32. def eventually(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R, Nothing, A]

    Permalink

    Returns a ZManaged that ignores errors raised by the acquire effect and runs it repeatedly until it eventually succeeds.

  33. def exit(implicit trace: ZTraceElement): ZManaged[R, Nothing, Exit[E, A]]

    Permalink

    Returns an effect that semantically runs the effect on a fiber, producing an zio.Exit for the completion value of the fiber.

  34. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  35. final def firstSuccessOf[R1 <: R, E1 >: E, A1 >: A](rest: ⇒ Iterable[ZManaged[R1, E1, A1]])(implicit trace: ZTraceElement): ZManaged[R1, E1, A1]

    Permalink

    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.

  36. def flatMap[R1 <: R, E1 >: E, B](f: (A) ⇒ ZManaged[R1, E1, B])(implicit trace: ZTraceElement): ZManaged[R1, E1, B]

    Permalink

    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.

  37. def flatMapError[R1 <: R, E2](f: (E) ⇒ ZManaged[R1, Nothing, E2])(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R1, E2, A]

    Permalink

    Effectfully map the error channel

  38. def flatten[R1 <: R, E1 >: E, B](implicit ev: IsSubtypeOfOutput[A, ZManaged[R1, E1, B]], trace: ZTraceElement): ZManaged[R1, E1, B]

    Permalink

    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.

  39. def flattenZIO[R1 <: R, E1 >: E, B](implicit ev: IsSubtypeOfOutput[A, ZIO[R1, E1, B]], trace: ZTraceElement): ZManaged[R1, E1, B]

    Permalink

    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.

  40. def flip(implicit trace: ZTraceElement): ZManaged[R, A, E]

    Permalink

    Flip the error and result

  41. def flipWith[R1, A1, E1](f: (ZManaged[R, A, E]) ⇒ ZManaged[R1, A1, E1])(implicit trace: ZTraceElement): ZManaged[R1, E1, A1]

    Permalink

    Flip the error and result, then apply an effectful function to the effect

  42. def fold[B](failure: (E) ⇒ B, success: (A) ⇒ B)(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R, Nothing, B]

    Permalink

    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.

  43. def foldCause[B](failure: (Cause[E]) ⇒ B, success: (A) ⇒ B)(implicit trace: ZTraceElement): ZManaged[R, Nothing, B]

    Permalink

    A more powerful version of fold that allows recovering from any kind of failure except interruptions.

  44. def foldCauseManaged[R1 <: R, E1, A1](failure: (Cause[E]) ⇒ ZManaged[R1, E1, A1], success: (A) ⇒ ZManaged[R1, E1, A1])(implicit trace: ZTraceElement): ZManaged[R1, E1, A1]

    Permalink

    A more powerful version of foldManaged that allows recovering from any kind of failure except interruptions.

  45. def foldManaged[R1 <: R, E2, B](failure: (E) ⇒ ZManaged[R1, E2, B], success: (A) ⇒ ZManaged[R1, E2, B])(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R1, E2, B]

    Permalink

    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.

  46. def fork(implicit trace: ZTraceElement): ZManaged[R, Nothing, Fiber.Runtime[E, A]]

    Permalink

    Creates a ZManaged value that acquires the original resource in a fiber, and provides that fiber.

    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.

  47. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  48. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  49. def ignore(implicit trace: ZTraceElement): ZManaged[R, Nothing, Unit]

    Permalink

    Returns a new effect that ignores the success or failure of this effect.

  50. def ignoreReleaseFailures(implicit trace: ZTraceElement): ZManaged[R, E, A]

    Permalink

    Returns a new managed effect that ignores defects in finalizers.

  51. def isFailure(implicit trace: ZTraceElement): ZManaged[R, Nothing, Boolean]

    Permalink

    Returns whether this managed effect is a failure.

  52. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  53. def isSuccess(implicit trace: ZTraceElement): ZManaged[R, Nothing, Boolean]

    Permalink

    Returns whether this managed effect is a success.

  54. def map[B](f: (A) ⇒ B)(implicit trace: ZTraceElement): ZManaged[R, E, B]

    Permalink

    Returns an effect whose success is mapped by the specified f function.

  55. final def mapAttempt[B](f: (A) ⇒ B)(implicit ev: IsSubtypeOfError[E, Throwable], trace: ZTraceElement): ZManaged[R, Throwable, B]

    Permalink

    Returns an effect whose success is mapped by the specified side effecting f function, translating any thrown exceptions into typed failed effects.

  56. def mapBoth[E1, A1](f: (E) ⇒ E1, g: (A) ⇒ A1)(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R, E1, A1]

    Permalink

    Returns an effect whose failure and success channels have been mapped by the specified pair of functions, f and g.

  57. def mapError[E1](f: (E) ⇒ E1)(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R, E1, A]

    Permalink

    Returns an effect whose failure is mapped by the specified f function.

  58. def mapErrorCause[E1](f: (Cause[E]) ⇒ Cause[E1])(implicit trace: ZTraceElement): ZManaged[R, E1, A]

    Permalink

    Returns an effect whose full failure is mapped by the specified f function.

  59. def mapZIO[R1 <: R, E1 >: E, B](f: (A) ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZManaged[R1, E1, B]

    Permalink

    Effectfully maps the resource acquired by this value.

  60. def memoize(implicit trace: ZTraceElement): ZManaged[Any, Nothing, ZManaged[R, E, A]]

    Permalink
  61. def merge[A1 >: A](implicit ev1: IsSubtypeOfError[E, A1], ev2: CanFail[E], trace: ZTraceElement): ZManaged[R, Nothing, A1]

    Permalink

    Returns a new effect where the error channel has been merged into the success channel to their common combined type.

  62. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  63. final def none[B](implicit ev: IsSubtypeOfOutput[A, Option[B]], trace: ZTraceElement): ZManaged[R, Option[E], Unit]

    Permalink

    Requires the option produced by this value to be None.

  64. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  65. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  66. final def onExecutionContext(ec: ⇒ ExecutionContext)(implicit trace: ZTraceElement): ZManaged[R, E, A]

    Permalink

    Runs this managed effect, as well as any managed effects that are composed sequentially after it, using the specified ExecutionContext.

  67. final def onExecutor(executor: ⇒ Executor)(implicit trace: ZTraceElement): ZManaged[R, E, A]

    Permalink

    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.

  68. def onExit[R1 <: R](cleanup: (Exit[E, A]) ⇒ ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZManaged[R1, E, A]

    Permalink

    Ensures that a cleanup function runs when this ZManaged is finalized, after the existing finalizers.

  69. def onExitFirst[R1 <: R](cleanup: (Exit[E, A]) ⇒ ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZManaged[R1, E, A]

    Permalink

    Ensures that a cleanup function runs when this ZManaged is finalized, before the existing finalizers.

  70. def option(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R, Nothing, Option[A]]

    Permalink

    Executes this effect, skipping the error but returning optionally the success.

  71. def orDie(implicit ev1: IsSubtypeOfError[E, Throwable], ev2: CanFail[E], trace: ZTraceElement): ZManaged[R, Nothing, A]

    Permalink

    Translates effect failure into death of the fiber, making all failures unchecked and not a part of the type of the effect.

  72. def orDieWith(f: (E) ⇒ Throwable)(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R, Nothing, A]

    Permalink

    Keeps none of the errors, and terminates the fiber with them, using the specified function to convert the E into a Throwable.

  73. def orElse[R1 <: R, E2, A1 >: A](that: ⇒ ZManaged[R1, E2, A1])(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R1, E2, A1]

    Permalink

    Executes this effect and returns its value, if it succeeds, but otherwise executes the specified effect.

  74. def orElseEither[R1 <: R, E2, B](that: ⇒ ZManaged[R1, E2, B])(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R1, E2, Either[A, B]]

    Permalink

    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.

  75. final def orElseFail[E1](e1: ⇒ E1)(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R, E1, A]

    Permalink

    Executes this effect and returns its value, if it succeeds, but otherwise fails with the specified error.

  76. final def orElseOptional[R1 <: R, E1, A1 >: A](that: ⇒ ZManaged[R1, Option[E1], A1])(implicit ev: IsSubtypeOfError[E, Option[E1]], trace: ZTraceElement): ZManaged[R1, Option[E1], A1]

    Permalink

    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.

  77. final def orElseSucceed[A1 >: A](a1: ⇒ A1)(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R, Nothing, A1]

    Permalink

    Executes this effect and returns its value, if it succeeds, but otherwise succeeds with the specified value.

  78. def preallocate(implicit trace: ZTraceElement): ZIO[R, E, Managed[Nothing, A]]

    Permalink

    Preallocates the managed resource, resulting in a ZManaged that reserves and acquires immediately and cannot fail.

    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.

  79. def preallocateManaged(implicit trace: ZTraceElement): ZManaged[R, E, Managed[Nothing, A]]

    Permalink

    Preallocates the managed resource inside an outer managed, resulting in a ZManaged that reserves and acquires immediately and cannot fail.

  80. macro def provide[E1 >: E](layer: ZLayer[_, E1, _]*): ZManaged[Any, E1, A]

    Permalink

    Automatically assembles a layer for the ZManaged effect.

    Automatically assembles a layer for the ZManaged effect.

    Definition Classes
    ZManagedVersionSpecific
  81. def provideEnvironment(r: ⇒ ZEnvironment[R])(implicit trace: ZTraceElement): Managed[E, A]

    Permalink

    Provides the ZManaged effect with its required environment, which eliminates its dependency on R.

  82. final def provideLayer[E1 >: E, R0](layer: ⇒ ZLayer[R0, E1, R])(implicit trace: ZTraceElement): ZManaged[R0, E1, A]

    Permalink

    Provides a layer to the ZManaged, which translates it to another level.

  83. def provideService[Service <: R](service: Service)(implicit tag: Tag[Service], trace: ZTraceElement): Managed[E, A]

    Permalink

    Provides the ZManaged effect with the single service it requires.

    Provides the ZManaged effect with the single service it requires. If the managed effect requires more than one service use provideEnvironment instead.

  84. def provideSome[R0]: ProvideSomeLayerManagedPartiallyApplied[R0, R, E, A]

    Permalink

    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: ZManaged[Clock with Random, Nothing, Unit] = ???
    
    val managed2 = managed.provideSome[Random](clockLayer)
    Definition Classes
    ZManagedVersionSpecific
  85. def provideSomeEnvironment[R0](f: (ZEnvironment[R0]) ⇒ ZEnvironment[R])(implicit trace: ZTraceElement): ZManaged[R0, E, A]

    Permalink

    Transforms the environment being provided to this effect with the specified function.

  86. final def provideSomeLayer[R0]: ProvideSomeLayer[R0, R, E, A]

    Permalink

    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)
  87. def refineOrDie[E1](pf: PartialFunction[E, E1])(implicit ev1: IsSubtypeOfError[E, Throwable], ev2: CanFail[E], trace: ZTraceElement): ZManaged[R, E1, A]

    Permalink

    Keeps some of the errors, and terminates the fiber with the rest.

  88. def refineOrDieWith[E1](pf: PartialFunction[E, E1])(f: (E) ⇒ Throwable)(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R, E1, A]

    Permalink

    Keeps some of the errors, and terminates the fiber with the rest, using the specified function to convert the E into a Throwable.

  89. def reject[E1 >: E](pf: PartialFunction[A, E1])(implicit trace: ZTraceElement): ZManaged[R, E1, A]

    Permalink

    Fail with the returned value if the PartialFunction matches, otherwise continue with our held value.

  90. def rejectManaged[R1 <: R, E1 >: E](pf: PartialFunction[A, ZManaged[R1, E1, E1]])(implicit trace: ZTraceElement): ZManaged[R1, E1, A]

    Permalink

    Continue with the returned computation if the PartialFunction matches, translating the successful match into a failure, otherwise continue with our held value.

  91. def release(implicit trace: ZTraceElement): ZManaged[R, E, A]

    Permalink

    Runs all the finalizers associated with this 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.

  92. def reserve(implicit trace: ZTraceElement): UIO[Reservation[R, E, A]]

    Permalink

    Returns a Reservation that allows separately accessing effects describing resource acquisition and release.

  93. def retry[R1 <: R, S](policy: ⇒ Schedule[R1, E, S])(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R1, E, A]

    Permalink

    Retries with the specified retry policy.

    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".

  94. def sandbox(implicit trace: ZTraceElement): ZManaged[R, Cause[E], A]

    Permalink

    Exposes the full cause of failure of this effect.

  95. def sandboxWith[R1 <: R, E2, B](f: (ZManaged[R1, Cause[E], A]) ⇒ ZManaged[R1, Cause[E2], B])(implicit trace: ZTraceElement): ZManaged[R1, E2, B]

    Permalink

    Companion helper to sandbox.

    Companion helper to sandbox. Allows recovery, and partial recovery, from errors and defects alike.

  96. def scoped(implicit trace: ZTraceElement): ZIO[R with Scope, E, A]

    Permalink
  97. final def some[B](implicit ev: IsSubtypeOfOutput[A, Option[B]], trace: ZTraceElement): ZManaged[R, Option[E], B]

    Permalink

    Converts an option on values into an option on errors.

  98. final def someOrElse[B](default: ⇒ B)(implicit ev: IsSubtypeOfOutput[A, Option[B]], trace: ZTraceElement): ZManaged[R, E, B]

    Permalink

    Extracts the optional value, or returns the given 'default'.

  99. final def someOrElseManaged[B, R1 <: R, E1 >: E](default: ⇒ ZManaged[R1, E1, B])(implicit ev: IsSubtypeOfOutput[A, Option[B]], trace: ZTraceElement): ZManaged[R1, E1, B]

    Permalink

    Extracts the optional value, or executes the effect 'default'.

  100. final def someOrFail[B, E1 >: E](e: ⇒ E1)(implicit ev: IsSubtypeOfOutput[A, Option[B]], trace: ZTraceElement): ZManaged[R, E1, B]

    Permalink

    Extracts the optional value, or fails with the given error 'e'.

  101. final def someOrFailException[B, E1 >: E](implicit ev: IsSubtypeOfOutput[A, Option[B]], ev2: <:<[NoSuchElementException, E1], trace: ZTraceElement): ZManaged[R, E1, B]

    Permalink

    Extracts the optional value, or fails with a java.util.NoSuchElementException

  102. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  103. def tap[R1 <: R, E1 >: E](f: (A) ⇒ ZManaged[R1, E1, Any])(implicit trace: ZTraceElement): ZManaged[R1, E1, A]

    Permalink

    Returns an effect that effectfully peeks at the acquired resource.

  104. def tapBoth[R1 <: R, E1 >: E](f: (E) ⇒ ZManaged[R1, E1, Any], g: (A) ⇒ ZManaged[R1, E1, Any])(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R1, E1, A]

    Permalink

    Returns an effect that effectfully peeks at the failure or success of the acquired resource.

  105. final def tapDefect[R1 <: R, E1 >: E](f: (Cause[Nothing]) ⇒ ZManaged[R1, E1, Any])(implicit trace: ZTraceElement): ZManaged[R1, E1, A]

    Permalink

    Returns an effect that effectually "peeks" at the defect of the acquired resource.

  106. def tapError[R1 <: R, E1 >: E](f: (E) ⇒ ZManaged[R1, E1, Any])(implicit ev: CanFail[E], trace: ZTraceElement): ZManaged[R1, E1, A]

    Permalink

    Returns an effect that effectfully peeks at the failure of the acquired resource.

  107. final def tapErrorCause[R1 <: R, E1 >: E](f: (Cause[E]) ⇒ ZManaged[R1, E1, Any])(implicit trace: ZTraceElement): ZManaged[R1, E1, A]

    Permalink

    Returns an effect that effectually peeks at the cause of the failure of the acquired resource.

  108. def tapZIO[R1 <: R, E1 >: E](f: (A) ⇒ ZIO[R1, E1, Any])(implicit trace: ZTraceElement): ZManaged[R1, E1, A]

    Permalink

    Like ZManaged#tap, but uses a function that returns a ZIO value rather than a ZManaged value.

  109. def timed(implicit trace: ZTraceElement): ZManaged[R, E, (zio.Duration, A)]

    Permalink

    Returns a new effect that executes this one and times the acquisition of the resource.

  110. def timeout(d: ⇒ zio.Duration)(implicit trace: ZTraceElement): ZManaged[R, E, Option[A]]

    Permalink

    Returns an effect that will timeout this resource, returning None if the timeout elapses before the resource was reserved and acquired.

    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

  111. def toLayer[A1 >: A](implicit arg0: Tag[A1], trace: ZTraceElement): ZLayer[R, E, A1]

    Permalink

    Constructs a layer from this managed resource.

  112. final def toLayerEnvironment[B](implicit ev: <:<[A, ZEnvironment[B]], trace: ZTraceElement): ZLayer[R, E, B]

    Permalink

    Constructs a layer from this managed resource, which must return one or more services.

  113. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  114. def unit(implicit trace: ZTraceElement): ZManaged[R, E, Unit]

    Permalink

    Return unit while running the effect

  115. final def unless(b: ⇒ Boolean)(implicit trace: ZTraceElement): ZManaged[R, E, Option[A]]

    Permalink

    The moral equivalent of if (!p) exp

  116. final def unlessManaged[R1 <: R, E1 >: E](b: ⇒ ZManaged[R1, E1, Boolean])(implicit trace: ZTraceElement): ZManaged[R1, E1, Option[A]]

    Permalink

    The moral equivalent of if (!p) exp when p has side-effects

  117. def unsandbox[E1](implicit ev: IsSubtypeOfError[E, Cause[E1]], trace: ZTraceElement): ZManaged[R, E1, A]

    Permalink

    The inverse operation ZManaged.sandboxed

  118. final def unsome[E1](implicit ev: IsSubtypeOfError[E, Option[E1]], trace: ZTraceElement): ZManaged[R, E1, Option[A]]

    Permalink

    Converts an option on errors into an option on values.

  119. final def updateService[M]: UpdateService[R, E, A, M]

    Permalink

    Updates a service in the environment of this effect.

  120. final def updateServiceAt[Service]: UpdateServiceAt[R, E, A, Service]

    Permalink

    Updates a service at the specified key in the environment of this effect.

  121. def use[R1 <: R, E1 >: E, B](f: (A) ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Run an effect while acquiring the resource before and releasing it after

  122. def useDiscard[R1 <: R, E1 >: E, B](f: ⇒ ZIO[R1, E1, B])(implicit trace: ZTraceElement): ZIO[R1, E1, B]

    Permalink

    Run an effect while acquiring the resource before and releasing it after.

    Run an effect while acquiring the resource before and releasing it after. This does not provide the resource to the function

  123. def useForever(implicit trace: ZTraceElement): ZIO[R, E, Nothing]

    Permalink

    Use the resource until interruption.

    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.

  124. def useNow(implicit trace: ZTraceElement): ZIO[R, E, A]

    Permalink

    Runs the acquire and release actions and returns the result of this managed effect.

    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.

  125. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  126. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  127. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  128. def when(b: ⇒ Boolean)(implicit trace: ZTraceElement): ZManaged[R, E, Option[A]]

    Permalink

    The moral equivalent of if (p) exp

  129. def whenManaged[R1 <: R, E1 >: E](b: ⇒ ZManaged[R1, E1, Boolean])(implicit trace: ZTraceElement): ZManaged[R1, E1, Option[A]]

    Permalink

    The moral equivalent of if (p) exp when p has side-effects

  130. def withEarlyRelease(implicit trace: ZTraceElement): ZManaged[R, E, (UIO[Any], A)]

    Permalink

    Modifies this ZManaged to provide a canceler that can be used to eagerly execute the finalizer of this ZManaged.

    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.

  131. def withEarlyReleaseExit(e: ⇒ Exit[Any, Any])(implicit trace: ZTraceElement): ZManaged[R, E, (UIO[Any], A)]

    Permalink

    A more powerful version of withEarlyRelease that allows specifying an exit value in the event of early release.

  132. def withParallelism(n: ⇒ Int)(implicit trace: ZTraceElement): ZManaged[R, E, A]

    Permalink

    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.

  133. def withParallelismUnbounded(implicit trace: ZTraceElement): ZManaged[R, E, A]

    Permalink

    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.

  134. final def withRuntimeConfig(runtimeConfig: ⇒ RuntimeConfig)(implicit trace: ZTraceElement): ZManaged[R, E, A]

    Permalink

    Runs this managed effect on the specified runtime configuration, guaranteeing that this managed effect as well as managed effects that are composed sequentially after it will be run on the specified runtime configuration.

  135. def zip[R1 <: R, E1 >: E, A1](that: ⇒ ZManaged[R1, E1, A1])(implicit zippable: Zippable[A, A1], trace: ZTraceElement): ZManaged[R1, E1, Out]

    Permalink

    Named alias for <*>.

  136. def zipLeft[R1 <: R, E1 >: E, A1](that: ⇒ ZManaged[R1, E1, A1])(implicit trace: ZTraceElement): ZManaged[R1, E1, A]

    Permalink

    Named alias for <*.

  137. def zipPar[R1 <: R, E1 >: E, A1](that: ⇒ ZManaged[R1, E1, A1])(implicit zippable: Zippable[A, A1], trace: ZTraceElement): ZManaged[R1, E1, Out]

    Permalink

    Named alias for <&>.

  138. def zipParLeft[R1 <: R, E1 >: E, A1](that: ⇒ ZManaged[R1, E1, A1])(implicit trace: ZTraceElement): ZManaged[R1, E1, A]

    Permalink

    Named alias for <&.

  139. def zipParRight[R1 <: R, E1 >: E, A1](that: ⇒ ZManaged[R1, E1, A1])(implicit trace: ZTraceElement): ZManaged[R1, E1, A1]

    Permalink

    Named alias for &>.

  140. def zipRight[R1 <: R, E1 >: E, A1](that: ⇒ ZManaged[R1, E1, A1])(implicit trace: ZTraceElement): ZManaged[R1, E1, A1]

    Permalink

    Named alias for *>.

  141. def zipWith[R1 <: R, E1 >: E, A1, A2](that: ⇒ ZManaged[R1, E1, A1])(f: (A, A1) ⇒ A2)(implicit trace: ZTraceElement): ZManaged[R1, E1, A2]

    Permalink

    Returns an effect that executes both this effect and the specified effect, in sequence, combining their results with the specified f function.

  142. def zipWithPar[R1 <: R, E1 >: E, A1, A2](that: ⇒ ZManaged[R1, E1, A1])(f: (A, A1) ⇒ A2)(implicit trace: ZTraceElement): ZManaged[R1, E1, A2]

    Permalink

    Returns an effect that executes both this effect and the specified effect, in parallel, combining their results with the specified f function.

    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.

Inherited from Serializable

Inherited from Serializable

Inherited from ZManagedVersionSpecific[R, E, A]

Inherited from AnyRef

Inherited from Any

Ungrouped