Packages

object ZManaged extends ZManagedPlatformSpecific with Serializable

Linear Supertypes
Serializable, Serializable, ZManagedPlatformSpecific, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ZManaged
  2. Serializable
  3. Serializable
  4. ZManagedPlatformSpecific
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final class AccessMPartiallyApplied[R] extends AnyVal
  2. final class AccessManagedPartiallyApplied[R] extends AnyVal
  3. final class AccessPartiallyApplied[R] extends AnyVal
  4. type Finalizer = (Exit[Any, Any]) ⇒ UIO[Any]

    A finalizer used in a ReleaseMap.

    A finalizer used in a ReleaseMap. The Exit value passed to it is the result of executing ZManaged#use or an arbitrary value passed into ReleaseMap#release.

  5. final class IfM[R, E] extends AnyVal
  6. abstract class PreallocationScope extends AnyRef

    A scope in which resources can be safely preallocated.

    A scope in which resources can be safely preallocated. Passing a ZManaged to the apply method will create (inside an effect) a managed resource which is already acquired and cannot fail.

  7. final class ProvideSomeLayer[R0 <: Has[_], -R, +E, +A] extends AnyVal
  8. implicit final class RefineToOrDieOps[R, E <: Throwable, A] extends AnyVal
  9. abstract class ReleaseMap extends Serializable

    A ReleaseMap represents the finalizers associated with a scope.

    A ReleaseMap represents the finalizers associated with a scope.

    The design of ReleaseMap is inspired by ResourceT, written by Michael Snoyman @snoyberg. (https://github.com/snoyberg/conduit/blob/master/resourcet/Control/Monad/Trans/Resource/Internal.hs)

  10. abstract class Scope extends AnyRef

    A scope in which ZManaged values can be safely allocated.

    A scope in which ZManaged values can be safely allocated. Passing a managed resource to the apply method will return an effect that allocates the resource and returns it with an early-release handle.

  11. final class ServiceWithManagedPartiallyApplied[Service] extends AnyVal
  12. final class ServiceWithPartiallyApplied[Service] extends AnyVal
  13. final class UnlessM[R, E] extends AnyVal
  14. final class UpdateService[-R, +E, +A, M] extends AnyVal
  15. final class WhenM[R, E] extends AnyVal

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def absolve[R, E, A](v: ZManaged[R, E, Either[E, A]]): ZManaged[R, E, A]

    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.

  5. def access[R]: AccessPartiallyApplied[R]

    Create a managed that accesses the environment.

  6. def accessM[R]: AccessMPartiallyApplied[R]

    Create a managed that accesses the environment.

  7. def accessManaged[R]: AccessManagedPartiallyApplied[R]

    Create a managed that accesses the environment.

  8. def apply[R, E, A](run0: ZIO[(R, ReleaseMap), E, (Finalizer, A)]): ZManaged[R, E, A]

    Creates new ZManaged from a ZIO value that uses a ReleaseMap and returns a resource and a finalizer.

    Creates new ZManaged from a ZIO value that uses a ReleaseMap and returns a resource and a finalizer.

    The correct usage of this constructor consists of:

    • Properly registering a finalizer in the ReleaseMap as part of the ZIO value;
    • Managing interruption safety - take care to use ZIO.uninterruptible or ZIO.uninterruptibleMask to verify that the finalizer is registered in the ReleaseMap after acquiring the value;
    • Returning the finalizer returned from ReleaseMap#add. This is important to prevent double-finalization.
  9. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  10. val blocking: ZManaged[Blocking, Nothing, Unit]

    Returns a managed effect that describes shifting to the blocking executor as the acquire action and shifting back to the original executor as the release action.

    Returns a managed effect that describes shifting to the blocking executor as the acquire action and shifting back to the original executor as the release action.

    Definition Classes
    ZManagedPlatformSpecific
  11. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  12. def collect[R, E, A, B, Collection[+Element] <: Iterable[Element]](in: Collection[A])(f: (A) ⇒ ZManaged[R, Option[E], B])(implicit bf: zio.BuildFrom[Collection[A], B, Collection[B]]): ZManaged[R, E, Collection[B]]

    Evaluate each effect in the structure from left to right, collecting the the successful values and discarding the empty cases.

    Evaluate each effect in the structure from left to right, collecting the the successful values and discarding the empty cases. For a parallel version, see collectPar.

  13. def collectAll[R, E, A, Collection[+Element] <: Iterable[Element]](ms: Collection[ZManaged[R, E, A]])(implicit bf: zio.BuildFrom[Collection[ZManaged[R, E, A]], A, Collection[A]]): ZManaged[R, E, Collection[A]]

    Evaluate each effect in the structure from left to right, and collect the results.

    Evaluate each effect in the structure from left to right, and collect the results. For a parallel version, see collectAllPar.

  14. def collectAllPar[R, E, A, Collection[+Element] <: Iterable[Element]](as: Collection[ZManaged[R, E, A]])(implicit bf: zio.BuildFrom[Collection[ZManaged[R, E, A]], A, Collection[A]]): ZManaged[R, E, Collection[A]]

    Evaluate each effect in the structure in parallel, and collect the results.

    Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see collectAll.

  15. def collectAllParN[R, E, A, Collection[+Element] <: Iterable[Element]](n: Int)(as: Collection[ZManaged[R, E, A]])(implicit bf: zio.BuildFrom[Collection[ZManaged[R, E, A]], A, Collection[A]]): ZManaged[R, E, Collection[A]]

    Evaluate each effect in the structure in parallel, and collect the results.

    Evaluate each effect in the structure in parallel, and collect the results. For a sequential version, see collectAll.

    Unlike CollectAllPar, this method will use at most n fibers.

  16. def collectAllParN_[R, E, A](n: Int)(as: Iterable[ZManaged[R, E, A]]): ZManaged[R, E, Unit]

    Evaluate each effect in the structure in parallel, and discard the results.

    Evaluate each effect in the structure in parallel, and discard the results. For a sequential version, see collectAll_.

    Unlike CollectAllPar_, this method will use at most n fibers.

  17. def collectAllPar_[R, E, A](as: Iterable[ZManaged[R, E, A]]): ZManaged[R, E, Unit]

    Evaluate each effect in the structure in parallel, and discard the results.

    Evaluate each effect in the structure in parallel, and discard the results. For a sequential version, see collectAll_.

  18. def collectAll_[R, E, A](ms: Iterable[ZManaged[R, E, A]]): ZManaged[R, E, Unit]

    Evaluate each effect in the structure from left to right, and discard the results.

    Evaluate each effect in the structure from left to right, and discard the results. For a parallel version, see collectAllPar_.

  19. def collectFirst[R, E, A, B](as: Iterable[A])(f: (A) ⇒ ZManaged[R, E, Option[B]]): ZManaged[R, E, Option[B]]

    Collects the first element of the Iterable[A] for which the effectual function f returns Some.

  20. def collectPar[R, E, A, B, Collection[+Element] <: Iterable[Element]](in: Collection[A])(f: (A) ⇒ ZManaged[R, Option[E], B])(implicit bf: zio.BuildFrom[Collection[A], B, Collection[B]]): ZManaged[R, E, Collection[B]]

    Evaluate each effect in the structure in parallel, collecting the the successful values and discarding the empty cases.

  21. def collectParN[R, E, A, B, Collection[+Element] <: Iterable[Element]](n: Int)(in: Collection[A])(f: (A) ⇒ ZManaged[R, Option[E], B])(implicit bf: zio.BuildFrom[Collection[A], B, Collection[B]]): ZManaged[R, E, Collection[B]]

    Evaluate each effect in the structure in parallel, collecting the the successful values and discarding the empty cases.

    Evaluate each effect in the structure in parallel, collecting the the successful values and discarding the empty cases.

    Unlike collectPar, this method will use at most up to n fibers.

  22. def cond[E, A](predicate: Boolean, result: ⇒ A, error: ⇒ E): Managed[E, A]

    Similar to Either.cond, evaluate the predicate, return the given A as success if predicate returns true, and the given E as error otherwise

  23. def die(t: ⇒ Throwable): ZManaged[Any, Nothing, Nothing]

    Returns an effect that dies with the specified Throwable.

    Returns an effect that dies with the specified Throwable. This method can be used for terminating a fiber because a defect has been detected in the code.

  24. def dieMessage(message: ⇒ String): ZManaged[Any, Nothing, Nothing]

    Returns an effect that dies with a java.lang.RuntimeException having the specified text message.

    Returns an effect that dies with a java.lang.RuntimeException having the specified text message. This method can be used for terminating a fiber because a defect has been detected in the code.

  25. def done[E, A](r: ⇒ Exit[E, A]): ZManaged[Any, E, A]

    Returns an effect from a lazily evaluated zio.Exit value.

  26. def effect[A](r: ⇒ A): ZManaged[Any, Throwable, A]

    Lifts a synchronous side-effect into a ZManaged[R, Throwable, A], translating any thrown exceptions into typed failed effects.

  27. def effectTotal[A](r: ⇒ A): ZManaged[Any, Nothing, A]

    Lifts a by-name, pure value into a Managed.

  28. def environment[R]: ZManaged[R, Nothing, R]

    Accesses the whole environment of the effect.

  29. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  30. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  31. def exists[R, E, A](as: Iterable[A])(f: (A) ⇒ ZManaged[R, E, Boolean]): ZManaged[R, E, Boolean]

    Determines whether any element of the Iterable[A] satisfies the effectual predicate f.

  32. def fail[E](error: ⇒ E): ZManaged[Any, E, Nothing]

    Returns an effect that models failure with the specified error.

    Returns an effect that models failure with the specified error. The moral equivalent of throw for pure code.

  33. lazy val fiberId: ZManaged[Any, Nothing, Id]

    Returns an effect that succeeds with the Fiber.Id of the caller.

  34. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  35. def finalizer[R](f: URIO[R, Any]): ZManaged[R, Nothing, Unit]

    Creates an effect that only executes the provided finalizer as its release action.

  36. def finalizerExit[R](f: (Exit[Any, Any]) ⇒ URIO[R, Any]): ZManaged[R, Nothing, Unit]

    Creates an effect that only executes the provided function as its release action.

  37. def finalizerRef[R](initial: Finalizer): ZManaged[R, Nothing, Ref[Finalizer]]

    Creates an effect that executes a finalizer stored in a Ref.

    Creates an effect that executes a finalizer stored in a Ref. The Ref is yielded as the result of the effect, allowing for control flows that require mutating finalizers.

  38. def first[A]: ZManaged[(A, Any), Nothing, A]

    Returns an effectful function that extracts out the first element of a tuple.

  39. def firstSuccessOf[R, E, A](first: ZManaged[R, E, A], rest: Iterable[ZManaged[R, E, A]]): ZManaged[R, E, A]

    Returns a managed resource that attempts to acquire the first 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.

  40. def flatten[R, E, A](zManaged: ZManaged[R, E, ZManaged[R, E, A]]): ZManaged[R, E, A]

    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.

  41. def flattenM[R, E, A](zManaged: ZManaged[R, E, ZIO[R, E, A]]): ZManaged[R, E, A]

    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.

  42. def foldLeft[R, E, S, A](in: Iterable[A])(zero: S)(f: (S, A) ⇒ ZManaged[R, E, S]): ZManaged[R, E, S]

    Folds an Iterable[A] using an effectual function f, working sequentially from left to right.

  43. def forall[R, E, A](as: Iterable[A])(f: (A) ⇒ ZManaged[R, E, Boolean]): ZManaged[R, E, Boolean]

    Determines whether all elements of the Iterable[A] satisfy the effectual predicate f.

  44. final def foreach[R, E, A1, A2](in: Option[A1])(f: (A1) ⇒ ZManaged[R, E, A2]): ZManaged[R, E, Option[A2]]

    Applies the function f if the argument is non-empty and returns the results in a new Option[A2].

  45. def foreach[R, E, A1, A2, Collection[+Element] <: Iterable[Element]](in: Collection[A1])(f: (A1) ⇒ ZManaged[R, E, A2])(implicit bf: zio.BuildFrom[Collection[A1], A2, Collection[A2]]): ZManaged[R, E, Collection[A2]]

    Applies the function f to each element of the Collection[A] and returns the results in a new Collection[B].

    Applies the function f to each element of the Collection[A] and returns the results in a new Collection[B].

    For a parallel version of this method, see foreachPar. If you do not need the results, see foreach_ for a more efficient implementation.

  46. final def foreachExec[R, E, A, B, Collection[+Element] <: Iterable[Element]](as: Collection[A])(exec: ExecutionStrategy)(f: (A) ⇒ ZManaged[R, E, B])(implicit bf: zio.BuildFrom[Collection[A], B, Collection[B]]): ZManaged[R, E, Collection[B]]

    Applies the function f to each element of the Collection[A] and returns the result in a new Collection[B] using the specified execution strategy.

  47. def foreachPar[R, E, A1, A2, Collection[+Element] <: Iterable[Element]](as: Collection[A1])(f: (A1) ⇒ ZManaged[R, E, A2])(implicit bf: zio.BuildFrom[Collection[A1], A2, Collection[A2]]): ZManaged[R, E, Collection[A2]]

    Applies the function f to each element of the Collection[A] in parallel, and returns the results in a new Collection[B].

    Applies the function f to each element of the Collection[A] in parallel, and returns the results in a new Collection[B].

    For a sequential version of this method, see foreach.

  48. def foreachParN[R, E, A1, A2, Collection[+Element] <: Iterable[Element]](n: Int)(as: Collection[A1])(f: (A1) ⇒ ZManaged[R, E, A2])(implicit bf: zio.BuildFrom[Collection[A1], A2, Collection[A2]]): ZManaged[R, E, Collection[A2]]

    Applies the function f to each element of the Collection[A] in parallel, and returns the results in a new Collection[B].

    Applies the function f to each element of the Collection[A] in parallel, and returns the results in a new Collection[B].

    Unlike foreachPar, this method will use at most up to n fibers.

  49. def foreachParN_[R, E, A](n: Int)(as: Iterable[A])(f: (A) ⇒ ZManaged[R, E, Any]): ZManaged[R, E, Unit]

    Applies the function f to each element of the Iterable[A] and runs produced effects in parallel, discarding the results.

    Applies the function f to each element of the Iterable[A] and runs produced effects in parallel, discarding the results.

    Unlike foreachPar_, this method will use at most up to n fibers.

  50. def foreachPar_[R, E, A](as: Iterable[A])(f: (A) ⇒ ZManaged[R, E, Any]): ZManaged[R, E, Unit]

    Applies the function f to each element of the Iterable[A] and runs produced effects in parallel, discarding the results.

    Applies the function f to each element of the Iterable[A] and runs produced effects in parallel, discarding the results.

    For a sequential version of this method, see foreach_.

  51. def foreach_[R, E, A](as: Iterable[A])(f: (A) ⇒ ZManaged[R, E, Any]): ZManaged[R, E, Unit]

    Applies the function f to each element of the Iterable[A] and runs produced effects sequentially.

    Applies the function f to each element of the Iterable[A] and runs produced effects sequentially.

    Equivalent to foreach(as)(f).unit, but without the cost of building the list of results.

  52. def fromAutoCloseable[R, E, A <: AutoCloseable](fa: ZIO[R, E, A]): ZManaged[R, E, A]

    Creates a ZManaged from an AutoCloseable resource.

    Creates a ZManaged from an AutoCloseable resource. The resource's close method will be used as the release action.

  53. def fromEffect[R, E, A](fa: ZIO[R, E, A]): ZManaged[R, E, A]

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with no release action.

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with no release action. The effect will be performed interruptibly.

  54. def fromEffectUninterruptible[R, E, A](fa: ZIO[R, E, A]): ZManaged[R, E, A]

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with no release action.

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with no release action. The effect will be performed uninterruptibly. You usually want the ZManaged.fromEffect variant.

  55. def fromEither[E, A](v: ⇒ Either[E, A]): ZManaged[Any, E, A]

    Lifts an Either into a ZManaged value.

  56. def fromFunction[R, A](f: (R) ⇒ A): ZManaged[R, Nothing, A]

    Lifts a function R => A into a ZManaged[R, Nothing, A].

  57. def fromFunctionM[R, E, A](f: (R) ⇒ ZManaged[Any, E, A]): ZManaged[R, E, A]

    Lifts an effectful function whose effect requires no environment into an effect that requires the input to the function.

  58. def fromOption[A](v: ⇒ Option[A]): ZManaged[Any, Option[Nothing], A]

    Lifts an Option into a ZManaged but preserves the error as an option in the error channel, making it easier to compose in some scenarios.

  59. def fromTry[A](value: ⇒ Try[A]): TaskManaged[A]

    Lifts a Try into a ZManaged.

  60. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  61. def halt[E](cause: ⇒ Cause[E]): ZManaged[Any, E, Nothing]

    Returns an effect that models failure with the specified Cause.

  62. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  63. def identity[R]: ZManaged[R, Nothing, R]

    Returns the identity effectful function, which performs no effects

  64. def ifM[R, E](b: ZManaged[R, E, Boolean]): IfM[R, E]

    Runs onTrue if the result of b is true and onFalse otherwise.

  65. lazy val interrupt: ZManaged[Any, Nothing, Nothing]

    Returns an effect that is interrupted as if by the fiber calling this method.

  66. def interruptAs(fiberId: ⇒ Id): ZManaged[Any, Nothing, Nothing]

    Returns an effect that is interrupted as if by the specified fiber.

  67. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  68. def iterate[R, E, S](initial: S)(cont: (S) ⇒ Boolean)(body: (S) ⇒ ZManaged[R, E, S]): ZManaged[R, E, S]

    Iterates with the specified effectual function.

    Iterates with the specified effectual function. The moral equivalent of:

    var s = initial
    
    while (cont(s)) {
      s = body(s)
    }
    
    s
  69. def lock(executor: ⇒ Executor): ZManaged[Any, Nothing, Unit]

    Returns a managed effect that describes shifting to the specified executor as the acquire action and shifting back to the original executor as the release action.

  70. def loop[R, E, A, S](initial: S)(cont: (S) ⇒ Boolean, inc: (S) ⇒ S)(body: (S) ⇒ ZManaged[R, E, A]): ZManaged[R, E, List[A]]

    Loops with the specified effectual function, collecting the results into a list.

    Loops with the specified effectual function, collecting the results into a list. The moral equivalent of:

    var s  = initial
    var as = List.empty[A]
    
    while (cont(s)) {
      as = body(s) :: as
      s  = inc(s)
    }
    
    as.reverse
  71. def loop_[R, E, S](initial: S)(cont: (S) ⇒ Boolean, inc: (S) ⇒ S)(body: (S) ⇒ ZManaged[R, E, Any]): ZManaged[R, E, Unit]

    Loops with the specified effectual function purely for its effects.

    Loops with the specified effectual function purely for its effects. The moral equivalent of:

    var s = initial
    
    while (cont(s)) {
      body(s)
      s = inc(s)
    }
  72. def make[R, R1 <: R, E, A](acquire: ZIO[R, E, A])(release: (A) ⇒ ZIO[R1, Nothing, Any]): ZManaged[R1, E, A]

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action.

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action. The acquire and release actions will be performed uninterruptibly.

  73. def makeEffect[A](acquire: ⇒ A)(release: (A) ⇒ Any): ZManaged[Any, Throwable, A]

    Lifts a synchronous effect into ZManaged[R, Throwable, A] with a release action.

    Lifts a synchronous effect into ZManaged[R, Throwable, A] with a release action. The acquire and release actions will be performed uninterruptibly.

  74. def makeEffectTotal[A](acquire: ⇒ A)(release: (A) ⇒ Any): ZManaged[Any, Nothing, A]

    Lifts a synchronous effect that does not throw exceptions into a ZManaged[Any, Nothing, A] with a release action.

    Lifts a synchronous effect that does not throw exceptions into a ZManaged[Any, Nothing, A] with a release action. The acquire and release actions will be performed uninterruptibly.

  75. def makeEffectTotal_[A](acquire: ⇒ A)(release: ⇒ Any): ZManaged[Any, Nothing, A]

    Lifts a synchronous effect that does not throw exceptions into a ZManaged[Any, Nothing, A] with a release action that does not need access to the resource.

    Lifts a synchronous effect that does not throw exceptions into a ZManaged[Any, Nothing, A] with a release action that does not need access to the resource. The acquire and release actions will be performed uninterruptibly.

  76. def makeEffect_[A](acquire: ⇒ A)(release: ⇒ Any): ZManaged[Any, Throwable, A]

    Lifts a synchronous effect into ZManaged[R, Throwable, A] with a release action that does not need access to the resource.

    Lifts a synchronous effect into ZManaged[R, Throwable, A] with a release action that does not need access to the resource. The acquire and release actions will be performed uninterruptibly.

  77. def makeExit[R, R1 <: R, E, A](acquire: ZIO[R, E, A])(release: (A, Exit[Any, Any]) ⇒ ZIO[R1, Nothing, Any]): ZManaged[R1, E, A]

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action that handles Exit.

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action that handles Exit. The acquire and release actions will be performed uninterruptibly.

  78. def makeExit_[R, R1 <: R, E, A](acquire: ZIO[R, E, A])(release: (Exit[Any, Any]) ⇒ ZIO[R1, Nothing, Any]): ZManaged[R1, E, A]

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action that does not need access to the resource but handles Exit.

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action that does not need access to the resource but handles Exit. The acquire and release actions will be performed uninterruptibly.

  79. def makeInterruptible[R, E, A](acquire: ZIO[R, E, A])(release: (A) ⇒ URIO[R, Any]): ZManaged[R, E, A]

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action.

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action. The acquire action will be performed interruptibly, while release will be performed uninterruptibly.

  80. def makeInterruptible_[R, R1 <: R, E, A](acquire: ZIO[R, E, A])(release: ZIO[R1, Nothing, Any]): ZManaged[R1, E, A]

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action that does not require access to the resource.

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action that does not require access to the resource. The acquire action will be performed interruptibly, while release will be performed uninterruptibly.

  81. def makeReserve[R, E, A](reservation: ZIO[R, E, Reservation[R, E, A]]): ZManaged[R, E, A]

    Creates a ZManaged from a Reservation produced by an effect.

    Creates a ZManaged from a Reservation produced by an effect. Evaluating the effect that produces the reservation will be performed *uninterruptibly*, while the acquisition step of the reservation will be performed *interruptibly*. The release step will be performed uninterruptibly as usual.

    This two-phase acquisition allows for resource acquisition flows that can be safely interrupted and released. For an example, see Semaphore#withPermitsManaged.

  82. def make_[R, R1 <: R, E, A](acquire: ZIO[R, E, A])(release: ZIO[R1, Nothing, Any]): ZManaged[R1, E, A]

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action that does not need access to the resource.

    Lifts a ZIO[R, E, A] into ZManaged[R, E, A] with a release action that does not need access to the resource. The acquire and release actions will be performed uninterruptibly.

  83. def mapN[R, E, A, B, C, D, F](zManaged1: ZManaged[R, E, A], zManaged2: ZManaged[R, E, B], zManaged3: ZManaged[R, E, C], zManaged4: ZManaged[R, E, D])(f: (A, B, C, D) ⇒ F): ZManaged[R, E, F]

    Sequentially zips the specified effects using the specified combiner function.

  84. def mapN[R, E, A, B, C, D](zManaged1: ZManaged[R, E, A], zManaged2: ZManaged[R, E, B], zManaged3: ZManaged[R, E, C])(f: (A, B, C) ⇒ D): ZManaged[R, E, D]

    Sequentially zips the specified effects using the specified combiner function.

  85. def mapN[R, E, A, B, C](zManaged1: ZManaged[R, E, A], zManaged2: ZManaged[R, E, B])(f: (A, B) ⇒ C): ZManaged[R, E, C]

    Sequentially zips the specified effects using the specified combiner function.

  86. def mapParN[R, E, A, B, C, D, F](zManaged1: ZManaged[R, E, A], zManaged2: ZManaged[R, E, B], zManaged3: ZManaged[R, E, C], zManaged4: ZManaged[R, E, D])(f: (A, B, C, D) ⇒ F): ZManaged[R, E, F]

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

    Returns an effect that executes the specified effects in parallel, combining their results with the specified f function. If any effect fails, then the other effects will be interrupted.

  87. def mapParN[R, E, A, B, C, D](zManaged1: ZManaged[R, E, A], zManaged2: ZManaged[R, E, B], zManaged3: ZManaged[R, E, C])(f: (A, B, C) ⇒ D): ZManaged[R, E, D]

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

    Returns an effect that executes the specified effects in parallel, combining their results with the specified f function. If any effect fails, then the other effects will be interrupted.

  88. def mapParN[R, E, A, B, C](zManaged1: ZManaged[R, E, A], zManaged2: ZManaged[R, E, B])(f: (A, B) ⇒ C): ZManaged[R, E, C]

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

    Returns an effect that executes the specified effects in parallel, combining their results with the specified f function. If any effect fails, then the other effects will be interrupted.

  89. def memoize[R, E, A, B](f: (A) ⇒ ZManaged[R, E, B]): ZManaged[Any, Nothing, (A) ⇒ ZIO[R, E, B]]

    Returns a memoized version of the specified resourceful function in the context of a managed scope.

    Returns a memoized version of the specified resourceful function in the context of a managed scope. Each time the memoized function is evaluated a new resource will be acquired, if the function has not already been evaluated with that input, or else the previously acquired resource will be returned. All resources acquired by evaluating the function will be released at the end of the scope.

  90. def mergeAll[R, E, A, B](in: Iterable[ZManaged[R, E, A]])(zero: B)(f: (B, A) ⇒ B): ZManaged[R, E, B]

    Merges an Iterable[ZManaged] to a single ZManaged, working sequentially.

  91. def mergeAllPar[R, E, A, B](in: Iterable[ZManaged[R, E, A]])(zero: B)(f: (B, A) ⇒ B): ZManaged[R, E, B]

    Merges an Iterable[ZManaged] to a single ZManaged, working in parallel.

    Merges an Iterable[ZManaged] to a single ZManaged, working in parallel.

    Due to the parallel nature of this combinator, f must be both:

    • commutative: f(a, b) == f(b, a)
    • associative: f(a, f(b, c)) == f(f(a, b), c)
  92. def mergeAllParN[R, E, A, B](n: Int)(in: Iterable[ZManaged[R, E, A]])(zero: B)(f: (B, A) ⇒ B): ZManaged[R, E, B]

    Merges an Iterable[ZManaged] to a single ZManaged, working in parallel.

    Merges an Iterable[ZManaged] to a single ZManaged, working in parallel.

    Due to the parallel nature of this combinator, f must be both:

    • commutative: f(a, b) == f(b, a)
    • associative: f(a, f(b, c)) == f(f(a, b), c)

    Unlike mergeAllPar, this method will use at most up to n fibers.

  93. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  94. lazy val never: ZManaged[Any, Nothing, Nothing]

    Returns a ZManaged that never acquires a resource.

  95. val none: Managed[Nothing, Option[Nothing]]

    Returns a ZManaged with the empty value.

  96. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  97. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  98. lazy val preallocationScope: Managed[Nothing, PreallocationScope]

    Creates a scope in which resources can be safely preallocated.

  99. def readFile(path: String): ZManaged[Blocking, IOException, ZInputStream]
    Definition Classes
    ZManagedPlatformSpecific
  100. def readFile(path: Path): ZManaged[Blocking, IOException, ZInputStream]
    Definition Classes
    ZManagedPlatformSpecific
  101. def readURI(uri: URI): ZManaged[Blocking, IOException, ZInputStream]
    Definition Classes
    ZManagedPlatformSpecific
  102. def readURL(url: String): ZManaged[Blocking, IOException, ZInputStream]
    Definition Classes
    ZManagedPlatformSpecific
  103. def readURL(url: URL): ZManaged[Blocking, IOException, ZInputStream]
    Definition Classes
    ZManagedPlatformSpecific
  104. def reduceAll[R, E, A](a: ZManaged[R, E, A], as: Iterable[ZManaged[R, E, A]])(f: (A, A) ⇒ A): ZManaged[R, E, A]

    Reduces an Iterable[IO] to a single IO, working sequentially.

  105. def reduceAllPar[R, E, A](a: ZManaged[R, E, A], as: Iterable[ZManaged[R, E, A]])(f: (A, A) ⇒ A): ZManaged[R, E, A]

    Reduces an Iterable[IO] to a single IO, working in parallel.

  106. def reduceAllParN[R, E, A](n: Int)(a: ZManaged[R, E, A], as: Iterable[ZManaged[R, E, A]])(f: (A, A) ⇒ A): ZManaged[R, E, A]

    Reduces an Iterable[IO] to a single IO, working in parallel.

    Reduces an Iterable[IO] to a single IO, working in parallel.

    Unlike mergeAllPar, this method will use at most up to n fibers.

    This is not implemented in terms of ZIO.foreach / ZManaged.zipWithPar as otherwise all reservation phases would always run, causing unnecessary work

  107. lazy val releaseMap: ZManaged[Any, Nothing, ReleaseMap]

    Provides access to the entire map of resources allocated by this ZManaged.

  108. def require[R, E, A](error: ⇒ E): (ZManaged[R, E, Option[A]]) ⇒ ZManaged[R, E, A]

    Requires that the given ZManaged[E, Option[A]] contain a value.

    Requires that the given ZManaged[E, Option[A]] contain a value. If there is no value, then the specified error will be raised.

  109. def reserve[R, E, A](reservation: Reservation[R, E, A]): ZManaged[R, E, A]

    Lifts a pure Reservation[R, E, A] into ZManaged[R, E, A].

    Lifts a pure Reservation[R, E, A] into ZManaged[R, E, A]. The acquisition step is performed interruptibly.

  110. def runtime[R]: ZManaged[R, Nothing, Runtime[R]]

    Returns an ZManaged that accesses the runtime, which can be used to (unsafely) execute tasks.

    Returns an ZManaged that accesses the runtime, which can be used to (unsafely) execute tasks. This is useful for integration with legacy code that must call back into ZIO code.

  111. def sandbox[R, E, A](v: ZManaged[R, E, A]): ZManaged[R, Cause[E], A]
  112. lazy val scope: Managed[Nothing, Scope]

    Creates a scope in which resources can be safely allocated into together with a release action.

  113. def second[A]: ZManaged[(Any, A), Nothing, A]

    Returns an effectful function that extracts out the second element of a tuple.

  114. def service[A](implicit arg0: zio.Tag[A]): ZManaged[Has[A], Nothing, A]

    Accesses the specified service in the environment of the effect.

  115. def serviceWith[Service]: ServiceWithPartiallyApplied[Service]

    Effectfully accesses the specified service in the environment of the effect.

    Effectfully accesses the specified service in the environment of the effect.

    def foo(int: Int) = ZManaged.serviceWith[Foo](_.foo(int))
  116. def serviceWithManaged[Service]: ServiceWithManagedPartiallyApplied[Service]

    Effectfully accesses the specified managed service in the environment of the effect .

    Effectfully accesses the specified managed service in the environment of the effect .

    Especially useful for creating "accessor" methods on Services' companion objects accessing managed resources.

    trait Foo {
      def start(): ZManaged[Any, Nothing, Unit]
    }
    
    def start: ZManaged[Has[Foo], Nothing, Unit] =
      ZManaged.serviceWithManaged[Foo](_.start())
  117. def services[A, B, C, D](implicit arg0: zio.Tag[A], arg1: zio.Tag[B], arg2: zio.Tag[C], arg3: zio.Tag[D]): ZManaged[Has[A] with Has[B] with Has[C] with Has[D], Nothing, (A, B, C, D)]

    Accesses the specified services in the environment of the effect.

  118. def services[A, B, C](implicit arg0: zio.Tag[A], arg1: zio.Tag[B], arg2: zio.Tag[C]): ZManaged[Has[A] with Has[B] with Has[C], Nothing, (A, B, C)]

    Accesses the specified services in the environment of the effect.

  119. def services[A, B](implicit arg0: zio.Tag[A], arg1: zio.Tag[B]): ZManaged[Has[A] with Has[B], Nothing, (A, B)]

    Accesses the specified services in the environment of the effect.

  120. def shift(executor: ⇒ Executor): ZManaged[Any, Nothing, Unit]

    Returns a managed effect that describes shifting to the specified executor as the acquire action with no release action.

  121. def some[A](a: ⇒ A): UManaged[Option[A]]

    Returns an effect with the optional value.

  122. def succeed[A](r: ⇒ A): ZManaged[Any, Nothing, A]

    Lifts a lazy, pure value into a Managed.

  123. def suspend[R, E, A](zManaged: ⇒ ZManaged[R, E, A]): ZManaged[R, E, A]

    Returns a lazily constructed Managed.

  124. def swap[A, B]: ZManaged[(A, B), Nothing, (B, A)]

    Returns an effectful function that merely swaps the elements in a Tuple2.

  125. def switchable[R, E, A]: ZManaged[R, Nothing, (ZManaged[R, E, A]) ⇒ ZIO[R, E, A]]

    Returns a ZManaged value that represents a managed resource that can be safely swapped within the scope of the ZManaged.

    Returns a ZManaged value that represents a managed resource that can be safely swapped within the scope of the ZManaged. The function provided inside the ZManaged can be used to switch the resource currently in use.

    When the resource is switched, the finalizer for the previous finalizer will be executed uninterruptibly. If the effect executing inside the ZManaged#use is interrupted, the finalizer for the resource currently in use is guaranteed to execute.

    This constructor can be used to create an expressive control flow that uses several instances of a managed resource. For example:

    def makeWriter: Task[FileWriter]
    trait FileWriter {
      def write(data: Int): Task[Unit]
      def close: UIO[Unit]
    }
    
    val elements = List(1, 2, 3, 4)
    val writingProgram =
      ZManaged.switchable[Any, Throwable, FileWriter].use { switchWriter =>
        ZIO.foreach_(elements) { element =>
          for {
            writer <- switchWriter(makeWriter.toManaged(_.close))
            _      <- writer.write(element)
          } yield ()
        }
      }
  126. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  127. def toString(): String
    Definition Classes
    AnyRef → Any
  128. lazy val unit: ZManaged[Any, Nothing, Unit]

    Returns the effect resulting from mapping the success of this effect to unit.

  129. def unless[R, E](b: ⇒ Boolean)(zio: ⇒ ZManaged[R, E, Any]): ZManaged[R, E, Unit]

    The moral equivalent of if (!p) exp

  130. def unlessM[R, E](b: ZManaged[R, E, Boolean]): UnlessM[R, E]

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

  131. def unsandbox[R, E, A](v: ZManaged[R, Cause[E], A]): ZManaged[R, E, A]

    The inverse operation to sandbox.

    The inverse operation to sandbox. Submerges the full cause of failure.

  132. def unwrap[R, E, A](fa: ZIO[R, E, ZManaged[R, E, A]]): ZManaged[R, E, A]

    Unwraps a ZManaged that is inside a ZIO.

  133. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  134. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  135. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  136. def when[R, E](b: ⇒ Boolean)(zManaged: ⇒ ZManaged[R, E, Any]): ZManaged[R, E, Unit]

    The moral equivalent of if (p) exp

  137. def whenCase[R, E, A](a: ⇒ A)(pf: PartialFunction[A, ZManaged[R, E, Any]]): ZManaged[R, E, Unit]

    Runs an effect when the supplied PartialFunction matches for the given value, otherwise does nothing.

  138. def whenCaseM[R, E, A](a: ZManaged[R, E, A])(pf: PartialFunction[A, ZManaged[R, E, Any]]): ZManaged[R, E, Unit]

    Runs an effect when the supplied PartialFunction matches for the given effectful value, otherwise does nothing.

  139. def whenM[R, E](b: ZManaged[R, E, Boolean]): WhenM[R, E]

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

  140. def withChildren[R, E, A](get: (UIO[Chunk[Fiber.Runtime[Any, Any]]]) ⇒ ZManaged[R, E, A]): ZManaged[R, E, A]

    Locally installs a supervisor and an effect that succeeds with all the children that have been forked in the returned effect.

  141. def writeFile(path: Path): ZManaged[Blocking, IOException, ZOutputStream]
    Definition Classes
    ZManagedPlatformSpecific
  142. def writeFile(path: String): ZManaged[Blocking, IOException, ZOutputStream]
    Definition Classes
    ZManagedPlatformSpecific
  143. object Finalizer
  144. object ReleaseMap extends Serializable

Inherited from Serializable

Inherited from Serializable

Inherited from ZManagedPlatformSpecific

Inherited from AnyRef

Inherited from Any

Ungrouped