object ZManaged extends ZManagedPlatformSpecific with Serializable
- Alphabetic
- By Inheritance
- ZManaged
- Serializable
- ZManagedPlatformSpecific
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final class EnvironmentWithManagedPartiallyApplied[R] extends AnyVal
- final class EnvironmentWithPartiallyApplied[R] extends AnyVal
- final class EnvironmentWithZIOPartiallyApplied[R] extends AnyVal
- 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.
- final class IfManaged[R, E] extends AnyVal
- 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. - final class ProvideSomeLayer[R0, -R, +E, +A] extends AnyVal
- implicit final class RefineToOrDieOps[R, E <: Throwable, A] extends AnyVal
- 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) - 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. - final class ServiceAtPartiallyApplied[Service] extends AnyVal
- final class ServiceWithManagedPartiallyApplied[Service] extends AnyVal
- final class ServiceWithPartiallyApplied[Service] extends AnyVal
- final class ServiceWithZIOPartiallyApplied[Service] extends AnyVal
- final class UnlessManaged[R, E] extends AnyVal
- final class UpdateService[-R, +E, +A, M] extends AnyVal
- final class UpdateServiceAt[-R, +E, +A, Service] extends AnyVal
- final class WhenManaged[R, E] extends AnyVal
- sealed trait ZManagedConstructor[Input] extends AnyRef
A
ZManagedConstructor[Input]
knows how to construct aZManaged
value from an input of typeInput
.A
ZManagedConstructor[Input]
knows how to construct aZManaged
value from an input of typeInput
. This allows the type of theZManaged
value constructed to depend onInput
. - trait ZManagedConstructorLowPriority1 extends ZManagedConstructorLowPriority2
- trait ZManagedConstructorLowPriority2 extends AnyRef
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def absolve[R, E, A](v: => ZManaged[R, E, Either[E, A]])(implicit trace: ZTraceElement): ZManaged[R, E, A]
Submerges the error case of an
Either
into theZManaged
.Submerges the error case of an
Either
into theZManaged
. The inverse operation ofZManaged.either
. - def acquireRelease[R, R1 <: R, E, A](acquire: => ZIO[R, E, A])(release: => ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZManaged[R1, E, A]
Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action that does not need access to the resource.Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action that does not need access to the resource. The acquire and release actions will be performed uninterruptibly. - def acquireReleaseAttempt[A](acquire: => A)(release: => Any)(implicit trace: ZTraceElement): 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. - def acquireReleaseAttemptWith[A](acquire: => A)(release: (A) => Any)(implicit trace: ZTraceElement): 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. - def acquireReleaseExit[R, R1 <: R, E, A](acquire: => ZIO[R, E, A])(release: (Exit[Any, Any]) => ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZManaged[R1, E, A]
Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action that does not need access to the resource but handlesExit
.Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action that does not need access to the resource but handlesExit
. The acquire and release actions will be performed uninterruptibly. - def acquireReleaseExitWith[R, R1 <: R, E, A](acquire: => ZIO[R, E, A])(release: (A, Exit[Any, Any]) => ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZManaged[R1, E, A]
Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action that handlesExit
.Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action that handlesExit
. The acquire and release actions will be performed uninterruptibly. - def acquireReleaseInterruptible[R, R1 <: R, E, A](acquire: => ZIO[R, E, A])(release: => ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): 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.
- def acquireReleaseInterruptibleWith[R, R1 <: R, E, A](acquire: => ZIO[R, E, A])(release: (A) => URIO[R1, Any])(implicit trace: ZTraceElement): 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 action will be performed interruptibly, while release will be performed uninterruptibly.
- def acquireReleaseSucceed[A](acquire: => A)(release: => Any)(implicit trace: ZTraceElement): 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. - def acquireReleaseSucceedWith[A](acquire: => A)(release: (A) => Any)(implicit trace: ZTraceElement): 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. - def acquireReleaseWith[R, R1 <: R, E, A](acquire: => ZIO[R, E, A])(release: (A) => ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZManaged[R1, E, A]
Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action.Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action. The acquire and release actions will be performed uninterruptibly. - def apply[R, E, A](run0: ZIO[R, 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.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def attempt[A](r: => A)(implicit trace: ZTraceElement): ZManaged[Any, Throwable, A]
Lifts a synchronous side-effect into a
ZManaged[R, Throwable, A]
, translating any thrown exceptions into typed failed effects. - def blocking(implicit trace: ZTraceElement): ZManaged[Any, 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 therelease
action.Returns a managed effect that describes shifting to the blocking executor as the
acquire
action and shifting back to the original executor as therelease
action.- Definition Classes
- ZManagedPlatformSpecific
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- 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: ZTraceElement): 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
. - 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: ZTraceElement): 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
. - def collectAllDiscard[R, E, A](ms: => Iterable[ZManaged[R, E, A]])(implicit trace: ZTraceElement): 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
collectAllParDiscard
. - 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: ZTraceElement): 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
. - def collectAllParDiscard[R, E, A](as: => Iterable[ZManaged[R, E, A]])(implicit trace: ZTraceElement): 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
collectAllDiscard
. - def collectFirst[R, E, A, B](as: => Iterable[A])(f: (A) => ZManaged[R, E, Option[B]])(implicit trace: ZTraceElement): ZManaged[R, E, Option[B]]
Collects the first element of the
Iterable[A]
for which the effectual functionf
returnsSome
. - 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: ZTraceElement): ZManaged[R, E, Collection[B]]
Evaluate each effect in the structure in parallel, collecting the the successful values and discarding the empty cases.
- def cond[E, A](predicate: => Boolean, result: => A, error: => E)(implicit trace: ZTraceElement): 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
- lazy val currentReleaseMap: FiberRef[ReleaseMap]
- def die(t: => Throwable)(implicit trace: ZTraceElement): 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. - def dieMessage(message: => String)(implicit trace: ZTraceElement): 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.
- def done[E, A](r: => Exit[E, A])(implicit trace: ZTraceElement): ZManaged[Any, E, A]
Returns an effect from a lazily evaluated zio.Exit value.
- def environment[R](implicit trace: ZTraceElement): ZManaged[R, Nothing, ZEnvironment[R]]
Accesses the whole environment of the effect.
- def environmentWith[R]: EnvironmentWithPartiallyApplied[R]
Create a managed that accesses the environment.
- def environmentWithManaged[R]: EnvironmentWithManagedPartiallyApplied[R]
Create a managed that accesses the environment.
- def environmentWithZIO[R]: EnvironmentWithZIOPartiallyApplied[R]
Create a managed that accesses the environment.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def exists[R, E, A](as: => Iterable[A])(f: (A) => ZManaged[R, E, Boolean])(implicit trace: ZTraceElement): ZManaged[R, E, Boolean]
Determines whether any element of the
Iterable[A]
satisfies the effectual predicatef
. - def fail[E](error: => E)(implicit trace: ZTraceElement): 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. - def failCause[E](cause: => Cause[E])(implicit trace: ZTraceElement): ZManaged[Any, E, Nothing]
Returns an effect that models failure with the specified
Cause
. - def fiberId(implicit trace: ZTraceElement): ZManaged[Any, Nothing, FiberId]
Returns an effect that succeeds with the
FiberId
of the caller. - def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def finalizer[R](f: => URIO[R, Any])(implicit trace: ZTraceElement): ZManaged[R, Nothing, Unit]
Creates an effect that only executes the provided finalizer as its release action.
- def finalizerExit[R](f: (Exit[Any, Any]) => URIO[R, Any])(implicit trace: ZTraceElement): ZManaged[R, Nothing, Unit]
Creates an effect that only executes the provided function as its release action.
- def finalizerRef[R](initial: => Finalizer)(implicit trace: ZTraceElement): 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. - def firstSuccessOf[R, E, A](first: => ZManaged[R, E, A], rest: => Iterable[ZManaged[R, E, A]])(implicit trace: ZTraceElement): 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.
- def flatten[R, E, A](zManaged: => ZManaged[R, E, ZManaged[R, E, A]])(implicit trace: ZTraceElement): 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.
- def flattenZIO[R, E, A](zManaged: => ZManaged[R, E, ZIO[R, E, A]])(implicit trace: ZTraceElement): 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.
- def foldLeft[R, E, S, A](in: => Iterable[A])(zero: => S)(f: (S, A) => ZManaged[R, E, S])(implicit trace: ZTraceElement): ZManaged[R, E, S]
Folds an Iterable[A] using an effectual function f, working sequentially from left to right.
- def forall[R, E, A](as: => Iterable[A])(f: (A) => ZManaged[R, E, Boolean])(implicit trace: ZTraceElement): ZManaged[R, E, Boolean]
Determines whether all elements of the
Iterable[A]
satisfy the effectual predicatef
. - final def foreach[R, E, A1, A2](in: Option[A1])(f: (A1) => ZManaged[R, E, A2])(implicit trace: ZTraceElement): ZManaged[R, E, Option[A2]]
Applies the function
f
if the argument is non-empty and returns the results in a newOption[A2]
. - 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: ZTraceElement): ZManaged[R, E, Collection[A2]]
Applies the function
f
to each element of theCollection[A]
and returns the results in a newCollection[B]
.Applies the function
f
to each element of theCollection[A]
and returns the results in a newCollection[B]
.For a parallel version of this method, see
foreachPar
. If you do not need the results, seeforeachDiscard
for a more efficient implementation. - def foreachDiscard[R, E, A](as: => Iterable[A])(f: (A) => ZManaged[R, E, Any])(implicit trace: ZTraceElement): ZManaged[R, E, Unit]
Applies the function
f
to each element of theIterable[A]
and runs produced effects sequentially.Applies the function
f
to each element of theIterable[A]
and runs produced effects sequentially.Equivalent to
foreach(as)(f).unit
, but without the cost of building the list of results. - 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: ZTraceElement): ZManaged[R, E, Collection[B]]
Applies the function
f
to each element of theCollection[A]
and returns the result in a newCollection[B]
using the specified execution strategy. - 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: ZTraceElement): ZManaged[R, E, Collection[A2]]
Applies the function
f
to each element of theCollection[A]
in parallel, and returns the results in a newCollection[B]
.Applies the function
f
to each element of theCollection[A]
in parallel, and returns the results in a newCollection[B]
.For a sequential version of this method, see
foreach
. - def foreachParDiscard[R, E, A](as: => Iterable[A])(f: (A) => ZManaged[R, E, Any])(implicit trace: ZTraceElement): ZManaged[R, E, Unit]
Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.For a sequential version of this method, see
foreachDiscard
. - def from[Input](input: => Input)(implicit constructor: ZManagedConstructor[Input], trace: ZTraceElement): Out
Constructs a
ZManaged
value of the appropriate type for the specified input. - def fromAutoCloseable[R, E, A <: AutoCloseable](fa: => ZIO[R, E, A])(implicit trace: ZTraceElement): ZManaged[R, E, A]
Creates a ZManaged from an
AutoCloseable
resource.Creates a ZManaged from an
AutoCloseable
resource. The resource'sclose
method will be used as the release action. - def fromEither[E, A](v: => Either[E, A])(implicit trace: ZTraceElement): ZManaged[Any, E, A]
Lifts an
Either
into aZManaged
value. - def fromOption[A](v: => Option[A])(implicit trace: ZTraceElement): ZManaged[Any, Option[Nothing], A]
Lifts an
Option
into aZManaged
but preserves the error as an option in the error channel, making it easier to compose in some scenarios. - def fromReservation[R, E, A](reservation: => Reservation[R, E, A])(implicit trace: ZTraceElement): ZManaged[R, E, A]
Lifts a pure
Reservation[R, E, A]
intoZManaged[R, E, A]
.Lifts a pure
Reservation[R, E, A]
intoZManaged[R, E, A]
. The acquisition step is performed interruptibly. - def fromReservationZIO[R, E, A](reservation: => ZIO[R, E, Reservation[R, E, A]])(implicit trace: ZTraceElement): 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.
- def fromTry[A](value: => Try[A])(implicit trace: ZTraceElement): TaskManaged[A]
Lifts a
Try
into aZManaged
. - def fromZIO[R, E, A](fa: => ZIO[R, E, A])(implicit trace: ZTraceElement): 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.
- def fromZIOUninterruptible[R, E, A](fa: => ZIO[R, E, A])(implicit trace: ZTraceElement): 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.fromZIO variant.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def ifManaged[R, E](b: => ZManaged[R, E, Boolean]): IfManaged[R, E]
Runs
onTrue
if the result ofb
istrue
andonFalse
otherwise. - def interrupt(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Nothing]
Returns an effect that is interrupted as if by the fiber calling this method.
- def interruptAs(fiberId: => FiberId)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Nothing]
Returns an effect that is interrupted as if by the specified fiber.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def iterate[R, E, S](initial: => S)(cont: (S) => Boolean)(body: (S) => ZManaged[R, E, S])(implicit trace: ZTraceElement): 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
- def lock(executor: => Executor)(implicit trace: ZTraceElement): 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 therelease
action. - def log(message: => String)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Unit]
Logs the specified message at the current log level.
- def logAnnotate(key: => String, value: => String)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Unit]
Annotates each log in managed effects composed after this.
- def logAnnotations(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Map[String, String]]
Retrieves current log annotations.
- def logDebug(message: => String)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Unit]
Logs the specified message at the debug log level.
- def logError(message: => String)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Unit]
Logs the specified message at the error log level.
- def logErrorCause(cause: => Cause[Any])(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Unit]
Logs the specified cause as an error.
- def logFatal(message: => String)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Unit]
Logs the specified message at the fatal log level.
- def logInfo(message: => String)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Unit]
Logs the specified message at the informational log level.
- def logLevel(level: LogLevel)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Unit]
Sets the log level for managed effects composed after this.
- def logSpan(label: => String)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Unit]
Adjusts the label for the logging span for managed effects composed after this.
- def logTrace(message: => String)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Unit]
Logs the specified message at the trace log level.
- def logWarning(message: => String)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Unit]
Logs the specified message at the warning log level.
- def loop[R, E, A, S](initial: => S)(cont: (S) => Boolean, inc: (S) => S)(body: (S) => ZManaged[R, E, A])(implicit trace: ZTraceElement): 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
- def loopDiscard[R, E, S](initial: => S)(cont: (S) => Boolean, inc: (S) => S)(body: (S) => ZManaged[R, E, Any])(implicit trace: ZTraceElement): 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) }
- def memoize[R, E, A, B](f: (A) => ZManaged[R, E, B])(implicit trace: ZTraceElement): 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.
- def mergeAll[R, E, A, B](in: => Iterable[ZManaged[R, E, A]])(zero: => B)(f: (B, A) => B)(implicit trace: ZTraceElement): ZManaged[R, E, B]
Merges an
Iterable[ZManaged]
to a singleZManaged
, working sequentially. - def mergeAllPar[R, E, A, B](in: => Iterable[ZManaged[R, E, A]])(zero: => B)(f: (B, A) => B)(implicit trace: ZTraceElement): ZManaged[R, E, B]
Merges an
Iterable[ZManaged]
to a singleZManaged
, working in parallel.Merges an
Iterable[ZManaged]
to a singleZManaged
, 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)
- commutative:
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def never(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Nothing]
Returns a
ZManaged
that never acquires a resource. - val none: Managed[Nothing, Option[Nothing]]
Returns a
ZManaged
with the empty value. - final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def onExecutor(executor: => Executor)(implicit trace: ZTraceElement): 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 therelease
action. - def parallelism(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Option[Int]]
Retrieves the maximum number of fibers for parallel operators or
None
if it is unbounded. - def preallocationScope(implicit trace: ZTraceElement): Managed[Nothing, PreallocationScope]
Creates a scope in which resources can be safely preallocated.
- 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: ZTraceElement): ZManaged[RIn with RIn2, E, ROut2]
- def readFile(path: String)(implicit trace: ZTraceElement): ZManaged[Any, IOException, ZInputStream]
- Definition Classes
- ZManagedPlatformSpecific
- def readFile(path: Path)(implicit trace: ZTraceElement): ZManaged[Any, IOException, ZInputStream]
- Definition Classes
- ZManagedPlatformSpecific
- def readURI(uri: URI)(implicit trace: ZTraceElement): ZManaged[Any, IOException, ZInputStream]
- Definition Classes
- ZManagedPlatformSpecific
- def readURL(url: String)(implicit trace: ZTraceElement): ZManaged[Any, IOException, ZInputStream]
- Definition Classes
- ZManagedPlatformSpecific
- def readURL(url: URL)(implicit trace: ZTraceElement): ZManaged[Any, IOException, ZInputStream]
- Definition Classes
- ZManagedPlatformSpecific
- def reduceAll[R, E, A](a: => ZManaged[R, E, A], as: => Iterable[ZManaged[R, E, A]])(f: (A, A) => A)(implicit trace: ZTraceElement): ZManaged[R, E, A]
Reduces an
Iterable[IO]
to a singleIO
, working sequentially. - def reduceAllPar[R, E, A](a: => ZManaged[R, E, A], as: => Iterable[ZManaged[R, E, A]])(f: (A, A) => A)(implicit trace: ZTraceElement): ZManaged[R, E, A]
Reduces an
Iterable[IO]
to a singleIO
, working in parallel. - def releaseMap(implicit trace: ZTraceElement): ZManaged[Any, Nothing, ReleaseMap]
Provides access to the entire map of resources allocated by this ZManaged.
- def runtime[R](implicit trace: ZTraceElement): 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.
- def sandbox[R, E, A](v: ZManaged[R, E, A])(implicit trace: ZTraceElement): ZManaged[R, Cause[E], A]
- def scope(implicit trace: ZTraceElement): Managed[Nothing, Scope]
Creates a scope in which resources can be safely allocated into together with a release action.
- def service[A](implicit arg0: Tag[A], trace: ZTraceElement): ZManaged[A, Nothing, A]
Accesses the specified service in the environment of the effect.
- def serviceAt[Service]: ServiceAtPartiallyApplied[Service]
Accesses the service corresponding to the specified key in the environment.
- def serviceWith[Service]: ServiceWithPartiallyApplied[Service]
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))
- 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[Foo, Nothing, Unit] = ZManaged.serviceWithManaged[Foo](_.start())
- def serviceWithZIO[Service]: ServiceWithZIOPartiallyApplied[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))
- def shift(executor: => Executor)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Unit]
Returns a managed effect that describes shifting to the specified executor as the
acquire
action with no release action. - def some[A](a: => A)(implicit trace: ZTraceElement): UManaged[Option[A]]
Returns an effect with the optional value.
- def succeed[A](r: => A)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, A]
Lifts a lazy, pure value into a Managed.
- def suspend[R, E, A](zManaged: => ZManaged[R, E, A])(implicit trace: ZTraceElement): ZManaged[R, E, A]
Returns a lazily constructed Managed.
- def switchable[R, E, A](implicit trace: ZTraceElement): 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.foreachDiscard(elements) { element => for { writer <- switchWriter(makeWriter.toManaged(_.close)) _ <- writer.write(element) } yield () } }
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- lazy val unit: ZManaged[Any, Nothing, Unit]
Returns the effect resulting from mapping the success of this effect to unit.
- def unless[R, E, A](b: => Boolean)(zManaged: => ZManaged[R, E, A])(implicit trace: ZTraceElement): ZManaged[R, E, Option[A]]
The moral equivalent of
if (!p) exp
- def unlessManaged[R, E](b: => ZManaged[R, E, Boolean]): UnlessManaged[R, E]
The moral equivalent of
if (!p) exp
whenp
has side-effects - def unsandbox[R, E, A](v: => ZManaged[R, Cause[E], A])(implicit trace: ZTraceElement): ZManaged[R, E, A]
The inverse operation to
sandbox
.The inverse operation to
sandbox
. Submerges the full cause of failure. - def unwrap[R, E, A](fa: => ZIO[R, E, ZManaged[R, E, A]])(implicit trace: ZTraceElement): ZManaged[R, E, A]
Unwraps a
ZManaged
that is inside aZIO
. - final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def when[R, E, A](b: => Boolean)(zManaged: => ZManaged[R, E, A])(implicit trace: ZTraceElement): ZManaged[R, E, Option[A]]
The moral equivalent of
if (p) exp
- def whenCase[R, E, A, B](a: => A)(pf: PartialFunction[A, ZManaged[R, E, B]])(implicit trace: ZTraceElement): ZManaged[R, E, Option[B]]
Runs an effect when the supplied
PartialFunction
matches for the given value, otherwise does nothing. - def whenCaseManaged[R, E, A, B](a: => ZManaged[R, E, A])(pf: PartialFunction[A, ZManaged[R, E, B]])(implicit trace: ZTraceElement): ZManaged[R, E, Option[B]]
Runs an effect when the supplied
PartialFunction
matches for the given effectful value, otherwise does nothing. - def whenManaged[R, E](b: => ZManaged[R, E, Boolean]): WhenManaged[R, E]
The moral equivalent of
if (p) exp
whenp
has side-effects - def withChildren[R, E, A](get: (UIO[Chunk[Fiber.Runtime[Any, Any]]]) => ZManaged[R, E, A])(implicit trace: ZTraceElement): 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.
- def withParallism(n: => Int)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Unit]
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 therelease
action. - def withParallismUnbounded(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Unit]
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 therelease
action. - def withRuntimeConfig(runtimeConfig: => RuntimeConfig)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, Unit]
Returns a managed effect that describes setting the runtime configuration to the specified value as the
acquire
action and setting it back to the original runtime configuration as therelease
action. - def writeFile(path: Path)(implicit trace: ZTraceElement): ZManaged[Any, IOException, ZOutputStream]
- Definition Classes
- ZManagedPlatformSpecific
- def writeFile(path: String)(implicit trace: ZTraceElement): ZManaged[Any, IOException, ZOutputStream]
- Definition Classes
- ZManagedPlatformSpecific
- object Finalizer
- object ReleaseMap extends Serializable
- object ZManagedConstructor extends ZManagedConstructorLowPriority1
Deprecated Value Members
- def access[R]: EnvironmentWithPartiallyApplied[R]
Create a managed that accesses the environment.
Create a managed that accesses the environment.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use environmentWith
- def accessM[R]: EnvironmentWithZIOPartiallyApplied[R]
Create a managed that accesses the environment.
Create a managed that accesses the environment.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use environmentWithZIO
- def accessManaged[R]: EnvironmentWithManagedPartiallyApplied[R]
Create a managed that accesses the environment.
Create a managed that accesses the environment.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use environmentWithManaged
- def accessZIO[R]: EnvironmentWithZIOPartiallyApplied[R]
Create a managed that accesses the environment.
Create a managed that accesses the environment.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use environmentWithZIO
- 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]], trace: ZTraceElement): 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 mostn
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectAllPar
- def collectAllParNDiscard[R, E, A](n: => Int)(as: => Iterable[ZManaged[R, E, A]])(implicit trace: ZTraceElement): 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
collectAllDiscard
.Unlike
collectAllParDiscard
, this method will use at mostn
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectAllParDiscard
- def collectAllParN_[R, E, A](n: => Int)(as: => Iterable[ZManaged[R, E, A]])(implicit trace: ZTraceElement): 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 mostn
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectAllParDiscard
- def collectAllPar_[R, E, A](as: => Iterable[ZManaged[R, E, A]])(implicit trace: ZTraceElement): 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_
.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectAllParDiscard
- def collectAll_[R, E, A](ms: => Iterable[ZManaged[R, E, A]])(implicit trace: ZTraceElement): 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_
.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectAllDiscard
- 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]], trace: ZTraceElement): 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 ton
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectAllPar
- def effect[A](r: => A)(implicit trace: ZTraceElement): ZManaged[Any, Throwable, A]
Lifts a synchronous side-effect into a
ZManaged[R, Throwable, A]
, translating any thrown exceptions into typed failed effects.Lifts a synchronous side-effect into a
ZManaged[R, Throwable, A]
, translating any thrown exceptions into typed failed effects.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use attempt
- def effectTotal[A](r: => A)(implicit trace: ZTraceElement): ZManaged[Any, Nothing, A]
Lifts a by-name, pure value into a Managed.
Lifts a by-name, pure value into a Managed.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use succeed
- def flattenM[R, E, A](zManaged: => ZManaged[R, E, ZIO[R, E, A]])(implicit trace: ZTraceElement): 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.
- Annotations
- @deprecated
- Deprecated
(Since version 2,0.0) use flattenZIO
- def foreachParN[R, E, A1, A2, Collection[+Element] <: Iterable[Element]](n0: => Int)(as: Collection[A1])(f: (A1) => ZManaged[R, E, A2])(implicit bf: zio.BuildFrom[Collection[A1], A2, Collection[A2]], trace: ZTraceElement): ZManaged[R, E, Collection[A2]]
Applies the function
f
to each element of theCollection[A]
in parallel, and returns the results in a newCollection[B]
.Applies the function
f
to each element of theCollection[A]
in parallel, and returns the results in a newCollection[B]
.Unlike
foreachPar
, this method will use at most up ton
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foreachPar
- def foreachParNDiscard[R, E, A](n0: => Int)(as: => Iterable[A])(f: (A) => ZManaged[R, E, Any])(implicit trace: ZTraceElement): ZManaged[R, E, Unit]
Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.Unlike
foreachParDiscard
, this method will use at most up ton
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foreachParDiscard
- def foreachParN_[R, E, A](n: => Int)(as: => Iterable[A])(f: (A) => ZManaged[R, E, Any])(implicit trace: ZTraceElement): ZManaged[R, E, Unit]
Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.Unlike
foreachPar_
, this method will use at most up ton
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foreachParDiscard
- def foreachPar_[R, E, A](as: => Iterable[A])(f: (A) => ZManaged[R, E, Any])(implicit trace: ZTraceElement): ZManaged[R, E, Unit]
Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.Applies the function
f
to each element of theIterable[A]
and runs produced effects in parallel, discarding the results.For a sequential version of this method, see
foreach_
.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foreachParDiscard
- def foreach_[R, E, A](as: => Iterable[A])(f: (A) => ZManaged[R, E, Any])(implicit trace: ZTraceElement): ZManaged[R, E, Unit]
Applies the function
f
to each element of theIterable[A]
and runs produced effects sequentially.Applies the function
f
to each element of theIterable[A]
and runs produced effects sequentially.Equivalent to
foreach(as)(f).unit
, but without the cost of building the list of results.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foreachDiscard
- def fromEffect[R, E, A](fa: => ZIO[R, E, A])(implicit trace: ZTraceElement): 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.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use fromZIO
- def fromEffectUninterruptible[R, E, A](fa: => ZIO[R, E, A])(implicit trace: ZTraceElement): 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.fromZIO variant.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use fromZIOUninterruptible
- def fromFunction[R, A](f: (ZEnvironment[R]) => A)(implicit trace: ZTraceElement): ZManaged[R, Nothing, A]
Lifts a function
R => A
into aZManaged[R, Nothing, A]
.Lifts a function
R => A
into aZManaged[R, Nothing, A]
.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use access
- def fromFunctionM[R, E, A](f: (ZEnvironment[R]) => ZManaged[Any, E, A])(implicit trace: ZTraceElement): ZManaged[R, E, A]
Lifts an effectful function whose effect requires no environment into an effect that requires the input to the function.
Lifts an effectful function whose effect requires no environment into an effect that requires the input to the function.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use environmentWithZIOManaged
- def halt[E](cause: => Cause[E])(implicit trace: ZTraceElement): ZManaged[Any, E, Nothing]
Returns an effect that models failure with the specified
Cause
.Returns an effect that models failure with the specified
Cause
.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use failCause
- def ifM[R, E](b: => ZManaged[R, E, Boolean]): IfManaged[R, E]
Runs
onTrue
if the result ofb
istrue
andonFalse
otherwise.Runs
onTrue
if the result ofb
istrue
andonFalse
otherwise.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use ifManaged
- def loop_[R, E, S](initial: => S)(cont: (S) => Boolean, inc: (S) => S)(body: (S) => ZManaged[R, E, Any])(implicit trace: ZTraceElement): 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) }
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use loopDiscard
- def make[R, R1 <: R, E, A](acquire: => ZIO[R, E, A])(release: (A) => ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZManaged[R1, E, A]
Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action.Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action. The acquire and release actions will be performed uninterruptibly.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use acquireReleaseWith
- def makeEffect[A](acquire: => A)(release: (A) => Any)(implicit trace: ZTraceElement): 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.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use acquireReleaseAttemptWith
- def makeEffectTotal[A](acquire: => A)(release: (A) => Any)(implicit trace: ZTraceElement): 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.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use acquireReleaseSucceedWith
- def makeEffectTotal_[A](acquire: => A)(release: => Any)(implicit trace: ZTraceElement): 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.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use acquireReleaseSucceed
- def makeEffect_[A](acquire: => A)(release: => Any)(implicit trace: ZTraceElement): 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.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use acquireReleaseAttempt
- def makeExit[R, R1 <: R, E, A](acquire: ZIO[R, E, A])(release: (A, Exit[Any, Any]) => ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZManaged[R1, E, A]
Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action that handlesExit
.Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action that handlesExit
. The acquire and release actions will be performed uninterruptibly.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use acquireReleaseExitWith
- def makeExit_[R, R1 <: R, E, A](acquire: => ZIO[R, E, A])(release: (Exit[Any, Any]) => ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZManaged[R1, E, A]
Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action that does not need access to the resource but handlesExit
.Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action that does not need access to the resource but handlesExit
. The acquire and release actions will be performed uninterruptibly.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use acquireReleaseExit
- def makeInterruptible[R, R1 <: R, E, A](acquire: => ZIO[R, E, A])(release: (A) => URIO[R, Any])(implicit trace: ZTraceElement): 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.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use acquireReleaseInterruptibleWith
- def makeInterruptible_[R, R1 <: R, E, A](acquire: => ZIO[R, E, A])(release: => ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): 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.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use acquireReleaseInterruptible
- def makeReserve[R, E, A](reservation: => ZIO[R, E, Reservation[R, E, A]])(implicit trace: ZTraceElement): 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.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use fromReservationZIO
- def make_[R, R1 <: R, E, A](acquire: => ZIO[R, E, A])(release: => ZIO[R1, Nothing, Any])(implicit trace: ZTraceElement): ZManaged[R1, E, A]
Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action that does not need access to the resource.Lifts a
ZIO[R, E, A]
intoZManaged[R, E, A]
with a release action that does not need access to the resource. The acquire and release actions will be performed uninterruptibly.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use acquireRelease
- 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)(implicit trace: ZTraceElement): ZManaged[R, E, F]
Sequentially zips the specified effects using the specified combiner function.
Sequentially zips the specified effects using the specified combiner function.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zip
- 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)(implicit trace: ZTraceElement): ZManaged[R, E, D]
Sequentially zips the specified effects using the specified combiner function.
Sequentially zips the specified effects using the specified combiner function.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zip
- def mapN[R, E, A, B, C](zManaged1: => ZManaged[R, E, A], zManaged2: => ZManaged[R, E, B])(f: (A, B) => C)(implicit trace: ZTraceElement): ZManaged[R, E, C]
Sequentially zips the specified effects using the specified combiner function.
Sequentially zips the specified effects using the specified combiner function.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zip
- 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)(implicit trace: ZTraceElement): 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.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zipPar
- 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)(implicit trace: ZTraceElement): 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.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zipPar
- def mapParN[R, E, A, B, C](zManaged1: => ZManaged[R, E, A], zManaged2: => ZManaged[R, E, B])(f: (A, B) => C)(implicit trace: ZTraceElement): 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.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use zipPar
- def mergeAllParN[R, E, A, B](n0: => Int)(in: => Iterable[ZManaged[R, E, A]])(zero: => B)(f: (B, A) => B)(implicit trace: ZTraceElement): ZManaged[R, E, B]
Merges an
Iterable[ZManaged]
to a singleZManaged
, working in parallel.Merges an
Iterable[ZManaged]
to a singleZManaged
, 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 ton
fibers.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use mergeAllPar
- commutative:
- def reduceAllParN[R, E, A](n0: => Int)(a: => ZManaged[R, E, A], as: => Iterable[ZManaged[R, E, A]])(f: (A, A) => A)(implicit trace: ZTraceElement): ZManaged[R, E, A]
Reduces an
Iterable[IO]
to a singleIO
, working in parallel.Reduces an
Iterable[IO]
to a singleIO
, working in parallel.Unlike
mergeAllPar
, this method will use at most up ton
fibers.This is not implemented in terms of ZIO.foreach / ZManaged.zipWithPar as otherwise all reservation phases would always run, causing unnecessary work
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use reduceAllPar
- def require[R, E, A](error: => E)(implicit trace: ZTraceElement): (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.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use someOrFail
- def reserve[R, E, A](reservation: => Reservation[R, E, A])(implicit trace: ZTraceElement): ZManaged[R, E, A]
Lifts a pure
Reservation[R, E, A]
intoZManaged[R, E, A]
.Lifts a pure
Reservation[R, E, A]
intoZManaged[R, E, A]
. The acquisition step is performed interruptibly.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use fromReservation
- def services[A, B, C, D](implicit arg0: Tag[A], arg1: Tag[B], arg2: Tag[C], arg3: Tag[D], trace: ZTraceElement): ZManaged[A with B with C with D, Nothing, (A, B, C, D)]
Accesses the specified services in the environment of the effect.
Accesses the specified services in the environment of the effect.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use service
- def services[A, B, C](implicit arg0: Tag[A], arg1: Tag[B], arg2: Tag[C], trace: ZTraceElement): ZManaged[A with B with C, Nothing, (A, B, C)]
Accesses the specified services in the environment of the effect.
Accesses the specified services in the environment of the effect.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use service
- def services[A, B](implicit arg0: Tag[A], arg1: Tag[B], trace: ZTraceElement): ZManaged[A with B, Nothing, (A, B)]
Accesses the specified services in the environment of the effect.
Accesses the specified services in the environment of the effect.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use service
- def unlessM[R, E](b: => ZManaged[R, E, Boolean]): UnlessManaged[R, E]
The moral equivalent of
if (!p) exp
whenp
has side-effectsThe moral equivalent of
if (!p) exp
whenp
has side-effects- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use unlessManaged
- def whenCaseM[R, E, A, B](a: => ZManaged[R, E, A])(pf: PartialFunction[A, ZManaged[R, E, B]])(implicit trace: ZTraceElement): ZManaged[R, E, Option[B]]
Runs an effect when the supplied
PartialFunction
matches for the given effectful value, otherwise does nothing.Runs an effect when the supplied
PartialFunction
matches for the given effectful value, otherwise does nothing.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use whenCaseManaged
- def whenM[R, E](b: => ZManaged[R, E, Boolean]): WhenManaged[R, E]
The moral equivalent of
if (p) exp
whenp
has side-effectsThe moral equivalent of
if (p) exp
whenp
has side-effects- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use whenManaged