Object/Class

zio.managed

ZManaged

Related Docs: class ZManaged | package managed

Permalink

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 EnvironmentWithManagedPartiallyApplied[R] extends AnyVal

    Permalink
  2. final class EnvironmentWithPartiallyApplied[R] extends AnyVal

    Permalink
  3. final class EnvironmentWithZIOPartiallyApplied[R] extends AnyVal

    Permalink
  4. type Finalizer = (Exit[Any, Any]) ⇒ UIO[Any]

    Permalink

    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 IfManaged[R, E] extends AnyVal

    Permalink
  6. abstract class PreallocationScope extends AnyRef

    Permalink

    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, -R, +E, +A] extends AnyVal

    Permalink
  8. implicit final class RefineToOrDieOps[R, E <: Throwable, A] extends AnyVal

    Permalink
  9. abstract class ReleaseMap extends Serializable

    Permalink

    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

    Permalink

    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 ScopedPartiallyApplied[R] extends AnyVal

    Permalink
  12. final class ServiceAtPartiallyApplied[Service] extends AnyVal

    Permalink
  13. final class ServiceWithManagedPartiallyApplied[Service] extends AnyVal

    Permalink
  14. final class ServiceWithPartiallyApplied[Service] extends AnyVal

    Permalink
  15. final class ServiceWithZIOPartiallyApplied[Service] extends AnyVal

    Permalink
  16. final class UnlessManaged[R, E] extends AnyVal

    Permalink
  17. final class UpdateService[-R, +E, +A, M] extends AnyVal

    Permalink
  18. final class UpdateServiceAt[-R, +E, +A, Service] extends AnyVal

    Permalink
  19. final class WhenManaged[R, E] extends AnyVal

    Permalink
  20. sealed trait ZManagedConstructor[Input] extends AnyRef

    Permalink

    A ZManagedConstructor[Input] knows how to construct a ZManaged value from an input of type Input.

    A ZManagedConstructor[Input] knows how to construct a ZManaged value from an input of type Input. This allows the type of the ZManaged value constructed to depend on Input.

  21. trait ZManagedConstructorLowPriority1 extends ZManagedConstructorLowPriority2

    Permalink
  22. trait ZManagedConstructorLowPriority2 extends AnyRef

    Permalink

Value Members

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object Finalizer

    Permalink
  5. object ReleaseMap extends Serializable

    Permalink
  6. object ZManagedConstructor extends ZManagedConstructorLowPriority1

    Permalink
  7. def absolve[R, E, A](v: ⇒ ZManaged[R, E, Either[E, A]])(implicit trace: Trace): ZManaged[R, E, A]

    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.

  8. def acquireRelease[R, R1 <: R, E, A](acquire: ⇒ ZIO[R, E, A])(release: ⇒ ZIO[R1, Nothing, Any])(implicit trace: Trace): ZManaged[R1, E, A]

    Permalink

    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.

  9. def acquireReleaseAttempt[A](acquire: ⇒ A)(release: ⇒ Any)(implicit trace: Trace): ZManaged[Any, Throwable, A]

    Permalink

    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.

  10. def acquireReleaseAttemptWith[A](acquire: ⇒ A)(release: (A) ⇒ Any)(implicit trace: Trace): ZManaged[Any, Throwable, A]

    Permalink

    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.

  11. def acquireReleaseExit[R, R1 <: R, E, A](acquire: ⇒ ZIO[R, E, A])(release: (Exit[Any, Any]) ⇒ ZIO[R1, Nothing, Any])(implicit trace: Trace): ZManaged[R1, E, A]

    Permalink

    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.

  12. def acquireReleaseExitWith[R, R1 <: R, E, A](acquire: ⇒ ZIO[R, E, A])(release: (A, Exit[Any, Any]) ⇒ ZIO[R1, Nothing, Any])(implicit trace: Trace): ZManaged[R1, E, A]

    Permalink

    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.

  13. def acquireReleaseInterruptible[R, R1 <: R, E, A](acquire: ⇒ ZIO[R, E, A])(release: ⇒ ZIO[R1, Nothing, Any])(implicit trace: Trace): ZManaged[R1, E, A]

    Permalink

    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.

  14. def acquireReleaseInterruptibleWith[R, R1 <: R, E, A](acquire: ⇒ ZIO[R, E, A])(release: (A) ⇒ URIO[R1, Any])(implicit trace: Trace): ZManaged[R1, E, A]

    Permalink

    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.

  15. def acquireReleaseSucceed[A](acquire: ⇒ A)(release: ⇒ Any)(implicit trace: Trace): ZManaged[Any, Nothing, A]

    Permalink

    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.

  16. def acquireReleaseSucceedWith[A](acquire: ⇒ A)(release: (A) ⇒ Any)(implicit trace: Trace): ZManaged[Any, Nothing, A]

    Permalink

    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.

  17. def acquireReleaseWith[R, R1 <: R, E, A](acquire: ⇒ ZIO[R, E, A])(release: (A) ⇒ ZIO[R1, Nothing, Any])(implicit trace: Trace): ZManaged[R1, E, A]

    Permalink

    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.

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

    Permalink

    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.
  19. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  20. def attempt[A](r: ⇒ A)(implicit trace: Trace): ZManaged[Any, Throwable, A]

    Permalink

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

  21. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. 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]], trace: Trace): ZManaged[R, E, Collection[B]]

    Permalink

    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.

  23. 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]], trace: Trace): ZManaged[R, E, Collection[A]]

    Permalink

    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.

  24. def collectAllDiscard[R, E, A](ms: ⇒ Iterable[ZManaged[R, E, A]])(implicit trace: Trace): ZManaged[R, E, Unit]

    Permalink

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

  25. 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]], trace: Trace): ZManaged[R, E, Collection[A]]

    Permalink

    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.

  26. def collectAllParDiscard[R, E, A](as: ⇒ Iterable[ZManaged[R, E, A]])(implicit trace: Trace): ZManaged[R, E, Unit]

    Permalink

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

  27. def collectFirst[R, E, A, B](as: ⇒ Iterable[A])(f: (A) ⇒ ZManaged[R, E, Option[B]])(implicit trace: Trace): ZManaged[R, E, Option[B]]

    Permalink

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

  28. 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]], trace: Trace): ZManaged[R, E, Collection[B]]

    Permalink

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

  29. def cond[E, A](predicate: ⇒ Boolean, result: ⇒ A, error: ⇒ E)(implicit trace: Trace): Managed[E, A]

    Permalink

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

  30. lazy val currentReleaseMap: FiberRef[ReleaseMap]

    Permalink
  31. def die(t: ⇒ Throwable)(implicit trace: Trace): ZManaged[Any, Nothing, Nothing]

    Permalink

    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.

  32. def dieMessage(message: ⇒ String)(implicit trace: Trace): ZManaged[Any, Nothing, Nothing]

    Permalink

    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.

  33. def done[E, A](r: ⇒ Exit[E, A])(implicit trace: Trace): ZManaged[Any, E, A]

    Permalink

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

  34. def environment[R](implicit trace: Trace): ZManaged[R, Nothing, ZEnvironment[R]]

    Permalink

    Accesses the whole environment of the effect.

  35. def environmentWith[R]: EnvironmentWithPartiallyApplied[R]

    Permalink

    Create a managed that accesses the environment.

  36. def environmentWithManaged[R]: EnvironmentWithManagedPartiallyApplied[R]

    Permalink

    Create a managed that accesses the environment.

  37. def environmentWithZIO[R]: EnvironmentWithZIOPartiallyApplied[R]

    Permalink

    Create a managed that accesses the environment.

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  40. def exists[R, E, A](as: ⇒ Iterable[A])(f: (A) ⇒ ZManaged[R, E, Boolean])(implicit trace: Trace): ZManaged[R, E, Boolean]

    Permalink

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

  41. def fail[E](error: ⇒ E)(implicit trace: Trace): ZManaged[Any, E, Nothing]

    Permalink

    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.

  42. def failCause[E](cause: ⇒ Cause[E])(implicit trace: Trace): ZManaged[Any, E, Nothing]

    Permalink

    Returns an effect that models failure with the specified Cause.

  43. def fiberId(implicit trace: Trace): ZManaged[Any, Nothing, FiberId]

    Permalink

    Returns an effect that succeeds with the FiberId of the caller.

  44. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  45. def finalizer[R](f: ⇒ URIO[R, Any])(implicit trace: Trace): ZManaged[R, Nothing, Unit]

    Permalink

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

  46. def finalizerExit[R](f: (Exit[Any, Any]) ⇒ URIO[R, Any])(implicit trace: Trace): ZManaged[R, Nothing, Unit]

    Permalink

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

  47. def finalizerRef[R](initial: ⇒ Finalizer)(implicit trace: Trace): ZManaged[R, Nothing, Ref[Finalizer]]

    Permalink

    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.

  48. def firstSuccessOf[R, E, A](first: ⇒ ZManaged[R, E, A], rest: ⇒ Iterable[ZManaged[R, E, A]])(implicit trace: Trace): ZManaged[R, E, A]

    Permalink

    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.

  49. def flatten[R, E, A](zManaged: ⇒ ZManaged[R, E, ZManaged[R, E, A]])(implicit trace: Trace): ZManaged[R, E, A]

    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.

  50. def flattenZIO[R, E, A](zManaged: ⇒ ZManaged[R, E, ZIO[R, E, A]])(implicit trace: Trace): ZManaged[R, E, A]

    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.

  51. def foldLeft[R, E, S, A](in: ⇒ Iterable[A])(zero: ⇒ S)(f: (S, A) ⇒ ZManaged[R, E, S])(implicit trace: Trace): ZManaged[R, E, S]

    Permalink

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

  52. def forall[R, E, A](as: ⇒ Iterable[A])(f: (A) ⇒ ZManaged[R, E, Boolean])(implicit trace: Trace): ZManaged[R, E, Boolean]

    Permalink

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

  53. final def foreach[R, E, A1, A2](in: Option[A1])(f: (A1) ⇒ ZManaged[R, E, A2])(implicit trace: Trace): ZManaged[R, E, Option[A2]]

    Permalink

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

  54. 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]], trace: Trace): ZManaged[R, E, Collection[A2]]

    Permalink

    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 foreachDiscard for a more efficient implementation.

  55. def foreachDiscard[R, E, A](as: ⇒ Iterable[A])(f: (A) ⇒ ZManaged[R, E, Any])(implicit trace: Trace): ZManaged[R, E, Unit]

    Permalink

    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.

  56. 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]], trace: Trace): ZManaged[R, E, Collection[B]]

    Permalink

    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.

  57. 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]], trace: Trace): ZManaged[R, E, Collection[A2]]

    Permalink

    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.

  58. def foreachParDiscard[R, E, A](as: ⇒ Iterable[A])(f: (A) ⇒ ZManaged[R, E, Any])(implicit trace: Trace): ZManaged[R, E, Unit]

    Permalink

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

  59. def from[Input](input: ⇒ Input)(implicit constructor: ZManagedConstructor[Input], trace: Trace): Out

    Permalink

    Constructs a ZManaged value of the appropriate type for the specified input.

  60. def fromAutoCloseable[R, E, A <: AutoCloseable](fa: ⇒ ZIO[R, E, A])(implicit trace: Trace): ZManaged[R, E, A]

    Permalink

    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.

  61. def fromEither[E, A](v: ⇒ Either[E, A])(implicit trace: Trace): ZManaged[Any, E, A]

    Permalink

    Lifts an Either into a ZManaged value.

  62. def fromOption[A](v: ⇒ Option[A])(implicit trace: Trace): ZManaged[Any, Option[Nothing], A]

    Permalink

    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.

  63. def fromReservation[R, E, A](reservation: ⇒ Reservation[R, E, A])(implicit trace: Trace): ZManaged[R, E, A]

    Permalink

    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.

  64. def fromReservationZIO[R, E, A](reservation: ⇒ ZIO[R, E, Reservation[R, E, A]])(implicit trace: Trace): ZManaged[R, E, A]

    Permalink

    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.

  65. def fromTry[A](value: ⇒ Try[A])(implicit trace: Trace): TaskManaged[A]

    Permalink

    Lifts a Try into a ZManaged.

  66. def fromZIO[R, E, A](fa: ⇒ ZIO[R, E, A])(implicit trace: Trace): ZManaged[R, E, A]

    Permalink

    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.

  67. def fromZIOUninterruptible[R, E, A](fa: ⇒ ZIO[R, E, A])(implicit trace: Trace): ZManaged[R, E, A]

    Permalink

    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.fromZIO variant.

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  70. def ifManaged[R, E](b: ⇒ ZManaged[R, E, Boolean]): IfManaged[R, E]

    Permalink

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

  71. def interrupt(implicit trace: Trace): ZManaged[Any, Nothing, Nothing]

    Permalink

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

  72. def interruptAs(fiberId: ⇒ FiberId)(implicit trace: Trace): ZManaged[Any, Nothing, Nothing]

    Permalink

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

  73. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  74. def iterate[R, E, S](initial: ⇒ S)(cont: (S) ⇒ Boolean)(body: (S) ⇒ ZManaged[R, E, S])(implicit trace: Trace): ZManaged[R, E, S]

    Permalink

    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
  75. def lock(executor: ⇒ Executor)(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

    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.

  76. def log(message: ⇒ String)(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

    Logs the specified message at the current log level.

  77. def logAnnotate(key: ⇒ String, value: ⇒ String)(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

    Annotates each log in managed effects composed after this.

  78. def logAnnotations(implicit trace: Trace): ZManaged[Any, Nothing, Map[String, String]]

    Permalink

    Retrieves current log annotations.

  79. def logDebug(message: ⇒ String)(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

    Logs the specified message at the debug log level.

  80. def logError(message: ⇒ String)(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

    Logs the specified message at the error log level.

  81. def logErrorCause(cause: ⇒ Cause[Any])(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

    Logs the specified cause as an error.

  82. def logFatal(message: ⇒ String)(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

    Logs the specified message at the fatal log level.

  83. def logInfo(message: ⇒ String)(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

    Logs the specified message at the informational log level.

  84. def logLevel(level: LogLevel)(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

    Sets the log level for managed effects composed after this.

  85. def logSpan(label: ⇒ String)(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

    Adjusts the label for the logging span for managed effects composed after this.

  86. def logTrace(message: ⇒ String)(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

    Logs the specified message at the trace log level.

  87. def logWarning(message: ⇒ String)(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

    Logs the specified message at the warning log level.

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

    Permalink

    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
  89. def loopDiscard[R, E, S](initial: ⇒ S)(cont: (S) ⇒ Boolean, inc: (S) ⇒ S)(body: (S) ⇒ ZManaged[R, E, Any])(implicit trace: Trace): ZManaged[R, E, Unit]

    Permalink

    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)
    }
  90. def memoize[R, E, A, B](f: (A) ⇒ ZManaged[R, E, B])(implicit trace: Trace): ZManaged[Any, Nothing, (A) ⇒ ZIO[R, E, B]]

    Permalink

    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.

  91. def mergeAll[R, E, A, B](in: ⇒ Iterable[ZManaged[R, E, A]])(zero: ⇒ B)(f: (B, A) ⇒ B)(implicit trace: Trace): ZManaged[R, E, B]

    Permalink

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

  92. def mergeAllPar[R, E, A, B](in: ⇒ Iterable[ZManaged[R, E, A]])(zero: ⇒ B)(f: (B, A) ⇒ B)(implicit trace: Trace): ZManaged[R, E, B]

    Permalink

    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)
  93. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  94. def never(implicit trace: Trace): ZManaged[Any, Nothing, Nothing]

    Permalink

    Returns a ZManaged that never acquires a resource.

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

    Permalink

    Returns a ZManaged with the empty value.

  96. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  98. def onExecutor(executor: ⇒ Executor)(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

    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.

  99. def parallelism(implicit trace: Trace): ZManaged[Any, Nothing, Option[Int]]

    Permalink

    Retrieves the maximum number of fibers for parallel operators or None if it is unbounded.

  100. def preallocationScope(implicit trace: Trace): Managed[Nothing, PreallocationScope]

    Permalink

    Creates a scope in which resources can be safely preallocated.

  101. def provideLayer[RIn, E, ROut, RIn2, ROut2](layer: ZLayer[RIn, E, ROut])(managed: ZManaged[ROut with RIn2, E, ROut2])(implicit ev: zio.EnvironmentTag[RIn2], tag: zio.EnvironmentTag[ROut], trace: Trace): ZManaged[RIn with RIn2, E, ROut2]

    Permalink
  102. def reduceAll[R, E, A](a: ⇒ ZManaged[R, E, A], as: ⇒ Iterable[ZManaged[R, E, A]])(f: (A, A) ⇒ A)(implicit trace: Trace): ZManaged[R, E, A]

    Permalink

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

  103. def reduceAllPar[R, E, A](a: ⇒ ZManaged[R, E, A], as: ⇒ Iterable[ZManaged[R, E, A]])(f: (A, A) ⇒ A)(implicit trace: Trace): ZManaged[R, E, A]

    Permalink

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

  104. def releaseMap(implicit trace: Trace): ZManaged[Any, Nothing, ReleaseMap]

    Permalink

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

  105. def runtime[R](implicit trace: Trace): ZManaged[R, Nothing, Runtime[R]]

    Permalink

    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.

  106. def sandbox[R, E, A](v: ZManaged[R, E, A])(implicit trace: Trace): ZManaged[R, Cause[E], A]

    Permalink
  107. def scope(implicit trace: Trace): Managed[Nothing, Scope]

    Permalink

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

  108. def scoped[R]: ScopedPartiallyApplied[R]

    Permalink
  109. def service[A](implicit arg0: Tag[A], trace: Trace): ZManaged[A, Nothing, A]

    Permalink

    Accesses the specified service in the environment of the effect.

  110. def serviceAt[Service]: ServiceAtPartiallyApplied[Service]

    Permalink

    Accesses the service corresponding to the specified key in the environment.

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

    Permalink

    Accesses the specified service in the environment of the effect.

    Accesses the specified service in the environment of the effect.

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

    Permalink

    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[Foo, Nothing, Unit] =
      ZManaged.serviceWithManaged[Foo](_.start())
  113. def serviceWithZIO[Service]: ServiceWithZIOPartiallyApplied[Service]

    Permalink

    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))
  114. def shift(executor: ⇒ Executor)(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

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

  115. def some[A](a: ⇒ A)(implicit trace: Trace): UManaged[Option[A]]

    Permalink

    Returns an effect with the optional value.

  116. def succeed[A](r: ⇒ A)(implicit trace: Trace): ZManaged[Any, Nothing, A]

    Permalink

    Lifts a lazy, pure value into a Managed.

  117. def suspend[R, E, A](zManaged: ⇒ ZManaged[R, E, A])(implicit trace: Trace): ZManaged[R, E, A]

    Permalink

    Returns a lazily constructed Managed.

  118. def switchable[R, E, A](implicit trace: Trace): ZManaged[R, Nothing, (ZManaged[R, E, A]) ⇒ ZIO[R, E, A]]

    Permalink

    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.foreachDiscard(elements) { element =>
          for {
            writer <- switchWriter(makeWriter.toManaged(_.close))
            _      <- writer.write(element)
          } yield ()
        }
      }
  119. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  120. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  121. lazy val unit: ZManaged[Any, Nothing, Unit]

    Permalink

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

  122. def unless[R, E, A](b: ⇒ Boolean)(zManaged: ⇒ ZManaged[R, E, A])(implicit trace: Trace): ZManaged[R, E, Option[A]]

    Permalink

    The moral equivalent of if (!p) exp

  123. def unlessManaged[R, E](b: ⇒ ZManaged[R, E, Boolean]): UnlessManaged[R, E]

    Permalink

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

  124. def unsandbox[R, E, A](v: ⇒ ZManaged[R, Cause[E], A])(implicit trace: Trace): ZManaged[R, E, A]

    Permalink

    The inverse operation to sandbox.

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

  125. def unwrap[R, E, A](fa: ⇒ ZIO[R, E, ZManaged[R, E, A]])(implicit trace: Trace): ZManaged[R, E, A]

    Permalink

    Unwraps a ZManaged that is inside a ZIO.

  126. final def wait(): Unit

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

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

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

    Permalink

    The moral equivalent of if (p) exp

  130. def whenCase[R, E, A, B](a: ⇒ A)(pf: PartialFunction[A, ZManaged[R, E, B]])(implicit trace: Trace): ZManaged[R, E, Option[B]]

    Permalink

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

  131. def whenCaseManaged[R, E, A, B](a: ⇒ ZManaged[R, E, A])(pf: PartialFunction[A, ZManaged[R, E, B]])(implicit trace: Trace): ZManaged[R, E, Option[B]]

    Permalink

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

  132. def whenManaged[R, E](b: ⇒ ZManaged[R, E, Boolean]): WhenManaged[R, E]

    Permalink

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

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

    Permalink

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

  134. def withParallism(n: ⇒ Int)(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

    Returns a managed effect that describes setting the specified maximum number of fibers for parallel operators as the acquire action and setting it back to the original value as the release action.

  135. def withParallismUnbounded(implicit trace: Trace): ZManaged[Any, Nothing, Unit]

    Permalink

    Returns a managed effect that describes setting an unbounded maximum number of fibers for parallel operators as the acquire action and setting it back to the original value as the release action.

Inherited from Serializable

Inherited from Serializable

Inherited from ZManagedPlatformSpecific

Inherited from AnyRef

Inherited from Any

Ungrouped