zio
package zio
- Alphabetic
- By Inheritance
- zio
- DurationModule
- VersionSpecific
- PlatformSpecific
- IntersectionTypeCompat
- FunctionToLayerOps
- EitherCompat
- BuildFromCompat
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- type &[+A, +B] = A with B
- Definition Classes
- IntersectionTypeCompat
- abstract class =!=[A, B] extends Serializable
Evidence type
Ais not equal to typeB.Evidence type
Ais not equal to typeB.Based on https://github.com/milessabin/shapeless.
- trait Accessible[R] extends AnyRef
A simple, macro-less means of creating accessors from Services.
A simple, macro-less means of creating accessors from Services. Extend the companion object with
Accessible[ServiceName], then simply callCompanion(_.someMethod), to return a ZIO effect that requires the Service in its environment.Example:
trait FooService { def magicNumber: UIO[Int] def castSpell(chant: String): UIO[Boolean] } object FooService extends Accessible[FooService] val example: ZIO[Has[FooService], Nothing, Unit] = for { int <- FooService(_.magicNumber) bool <- FooService(_.castSpell("Oogabooga!")) } yield ()
- type BuildFrom[-From, -A, +C] = scala.collection.BuildFrom[From, A, C]
- Definition Classes
- BuildFromCompat
- sealed abstract class CanFail[-E] extends AnyRef
A value of type
CanFail[E]provides implicit evidence that an effect with error typeEcan fail, that is, thatEis not equal toNothing. - abstract class CancelableFuture[+A] extends Future[A] with FutureTransformCompat[A]
- type Canceler[-R] = ZIO[R, Nothing, Any]
- sealed abstract class Cause[+E] extends Product with Serializable
- sealed abstract class Chunk[+A] extends ChunkLike[A]
A
Chunk[A]represents a chunk of values of typeA.A
Chunk[A]represents a chunk of values of typeA. Chunks are designed are usually backed by arrays, but expose a purely functional, safe interface to the underlying elements, and they become lazy on operations that would be costly with arrays, such as repeated concatenation.The implementation of balanced concatenation is based on the one for Conc-Trees in "Conc-Trees for Functional and Parallel Programming" by Aleksandar Prokopec and Martin Odersky. http://aleksandar-prokopec.com/resources/docs/lcpc-conc-trees.pdf
NOTE: For performance reasons
Chunkdoes not box primitive types. As a result, it is not safe to construct chunks from heterogeneous primitive types. - sealed abstract class ChunkBuilder[A] extends Builder[A, Chunk[A]]
A
ChunkBuilder[A]can build aChunk[A]given elements of typeA.A
ChunkBuilder[A]can build aChunk[A]given elements of typeA.ChunkBuilderis a mutable data structure that is implemented to efficiently build chunks of unboxed primitives and for compatibility with the Scala collection library. - trait ChunkLike[+A] extends IndexedSeq[A] with IndexedSeqOps[A, Chunk, Chunk[A]] with StrictOptimizedSeqOps[A, Chunk, Chunk[A]] with IterableFactoryDefaults[A, Chunk]
ChunkLikerepresents the capability for aChunkto extend Scala's collection library.ChunkLikerepresents the capability for aChunkto extend Scala's collection library. Because of changes to Scala's collection library in 2.13, separate versions of this trait are implemented for 2.11 / 2.12 and 2.13 / Dotty. This allows code inChunkto be written without concern for the implementation details of Scala's collection library to the maximum extent possible.Note that
IndexedSeqis not a referentially transparent interface in that it exposes methods that are partial (e.g.apply), allocate mutable state (e.g.iterator), or are purely side effecting (e.g.foreach).ChunkextendsIndexedSeqto provide interoperability with Scala's collection library but users should avoid these methods whenever possible. - trait Clock extends Serializable
- trait Console extends Serializable
- type Dequeue[+A] = ZQueue[Nothing, Any, Any, Nothing, Nothing, A]
- type Duration = java.time.Duration
- Definition Classes
- DurationModule
- trait DurationModule extends AnyRef
- final class DurationOps extends AnyVal
- final class DurationSyntax extends AnyVal
- type ERef[+E, A] = ZRef[Any, Any, E, E, A, A]
- type Enqueue[-A] = ZQueue[Any, Nothing, Nothing, Any, A, Any]
- sealed abstract class ExecutionStrategy extends AnyRef
Describes a strategy for evaluating multiple effects, potentially in parallel.
Describes a strategy for evaluating multiple effects, potentially in parallel. There are three possible execution strategies:
Sequential,Parallel, andParallelN. - abstract class Executor extends ExecutorPlatformSpecific
An executor is responsible for executing actions.
An executor is responsible for executing actions. Each action is guaranteed to begin execution on a fresh stack frame.
- trait ExecutorPlatformSpecific extends AnyRef
- sealed abstract class Exit[+E, +A] extends Product with Serializable
An
Exit[E, A]describes the result of executing anIOvalue.An
Exit[E, A]describes the result of executing anIOvalue. The result is either succeeded with a valueA, or failed with aCause[E]. - final case class ExitCode(code: Int) extends Product with Serializable
- sealed abstract class Fiber[+E, +A] extends AnyRef
A fiber is a lightweight thread of execution that never consumes more than a whole thread (but may consume much less, depending on contention and asynchronicity).
A fiber is a lightweight thread of execution that never consumes more than a whole thread (but may consume much less, depending on contention and asynchronicity). Fibers are spawned by forking ZIO effects, which run concurrently with the parent effect.
Fibers can be joined, yielding their result to other fibers, or interrupted, which terminates the fiber, safely releasing all resources.
def parallel[A, B](io1: Task[A], io2: Task[B]): Task[(A, B)] = for { fiber1 <- io1.fork fiber2 <- io2.fork a <- fiber1.join b <- fiber2.join } yield (a, b)
- final case class FiberFailure(cause: Cause[Any]) extends Throwable with Product with Serializable
Represents a failure in a fiber.
Represents a failure in a fiber. This could be caused by some non- recoverable error, such as a defect or system error, by some typed error, or by interruption (or combinations of all of the above).
This class is used to wrap ZIO failures into something that can be thrown, to better integrate with Scala exception handling.
- final case class FiberId(startTimeMillis: Long, seqNumber: Long) extends Serializable with Product
The identity of a Fiber, described by the time it began life, and a monotonically increasing sequence number generated from an atomic counter.
- type FiberRef[A] = ZFiberRef[Nothing, Nothing, A, A]
- trait FunctionToLayerOps extends AnyRef
- implicit final class Function0ToLayerSyntax[A] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function10ToLayerSyntax[A, B, C, D, E, F, G, H, I, J, K] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function11ToLayerSyntax[A, B, C, D, E, F, G, H, I, J, K, L] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function12ToLayerSyntax[A, B, C, D, E, F, G, H, I, J, K, L, M] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function13ToLayerSyntax[A, B, C, D, E, F, G, H, I, J, K, L, M, N] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function14ToLayerSyntax[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function15ToLayerSyntax[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function16ToLayerSyntax[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function17ToLayerSyntax[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function18ToLayerSyntax[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function19ToLayerSyntax[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function1ToLayerSyntax[A, B] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function20ToLayerSyntax[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function21ToLayerSyntax[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function2ToLayerSyntax[A, B, C] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function3ToLayerSyntax[A, B, C, D] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function4ToLayerSyntax[A, B, C, D, E] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function5ToLayerSyntax[A, B, C, D, E, F] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function6ToLayerSyntax[A, B, C, D, E, F, G] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function7ToLayerSyntax[A, B, C, D, E, F, G, H] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function8ToLayerSyntax[A, B, C, D, E, F, G, H, I] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- implicit final class Function9ToLayerSyntax[A, B, C, D, E, F, G, H, I, J] extends AnyRef
- Definition Classes
- FunctionToLayerOps
- final class Has[A] extends Serializable
The trait
Has[A]is used with ZIO environment to express an effect's dependency on a service of typeA.The trait
Has[A]is used with ZIO environment to express an effect's dependency on a service of typeA. For example,RIO[Has[Console], Unit]is an effect that requires aConsoleservice.Services parameterized on path dependent types are not supported.
- type HasMany[K, A] = Has[Map[K, A]]
- type Hub[A] = ZHub[Any, Any, Nothing, Nothing, A, A]
- type IO[+E, +A] = ZIO[Any, E, A]
- sealed abstract class InterruptStatus extends Serializable with Product
The
InterruptStatusof a fiber determines whether or not it can be interrupted.The
InterruptStatusof a fiber determines whether or not it can be interrupted. The status can change over time in different regions. - sealed abstract class IsSubtypeOfError[-A, +B] extends (A) => B with Serializable
- Annotations
- @implicitNotFound()
- sealed abstract class IsSubtypeOfOutput[-A, +B] extends (A) => B with Serializable
- Annotations
- @implicitNotFound()
- type Layer[+E, +ROut] = ZLayer[Any, E, ROut]
- type LightTypeTag = izumi.reflect.macrortti.LightTypeTag
- Definition Classes
- VersionSpecific
- final case class LogLevel(ordinal: Int, label: String, syslog: Int) extends ZIOAspect[Nothing, Any, Nothing, Any, Nothing, Any] with Product with Serializable
LogLevel represents the log level associated with an individual logging operation.
LogLevel represents the log level associated with an individual logging operation. Log levels are used both to describe the granularity (or importance) of individual log statements, as well as to enable tuning verbosity of log output.
- ordinal
The priority of the log message. Larger values indicate higher priority.
- label
A label associated with the log level.
- syslog
The syslog severity level of the log level. LogLevel values are ZIO aspects, and therefore can be used with aspect syntax.
myEffect @@ LogLevel.Info
- final case class LogSpan(label: String, startTime: Long) extends Product with Serializable
- type Managed[+E, +A] = ZManaged[Any, E, A]
- final case class MetricLabel(key: String, value: String) extends Product with Serializable
A
MetricLabelrepresents a key value pair that allows analyzing metrics at an additional level of granularity.A
MetricLabelrepresents a key value pair that allows analyzing metrics at an additional level of granularity. For example if a metric tracks the response time of a service labels could be used to create separate versions that track response times for different clients. - sealed abstract class NeedsEnv[+R] extends Serializable
A value of type
NeedsEnv[R]provides implicit evidence that an effect with environment typeRneeds an environment, that is, thatRis not equal toAny. - final class NonEmptyChunk[+A] extends AnyRef
A
NonEmptyChunkis aChunkthat is guaranteed to contain at least one element.A
NonEmptyChunkis aChunkthat is guaranteed to contain at least one element. As a result, operations which would not be safe when performed onChunk, such asheadorreduce, are safe when performed onNonEmptyChunk. Operations onNonEmptyChunkwhich could potentially return an empty chunk will return aChunkinstead. - final class Promise[E, A] extends Serializable
A promise represents an asynchronous variable, of zio.IO type, that can be set exactly once, with the ability for an arbitrary number of fibers to suspend (by calling
await) and automatically resume when the variable is set.A promise represents an asynchronous variable, of zio.IO type, that can be set exactly once, with the ability for an arbitrary number of fibers to suspend (by calling
await) and automatically resume when the variable is set.Promises can be used for building primitive actions whose completions require the coordinated action of multiple fibers, and for building higher-level concurrent or asynchronous structures.
for { promise <- Promise.make[Nothing, Int] _ <- promise.succeed(42).delay(1.second).fork value <- promise.await // Resumes when forked fiber completes promise } yield value
- type Queue[A] = ZQueue[Any, Any, Nothing, Nothing, A, A]
- type RIO[-R, +A] = ZIO[R, Throwable, A]
- type RLayer[-RIn, +ROut] = ZLayer[RIn, Throwable, ROut]
- type RManaged[-R, +A] = ZManaged[R, Throwable, A]
- trait Random extends Serializable
- type Ref[A] = ZRef[Any, Any, Nothing, Nothing, A, A]
- final case class Reservation[-R, +E, +A](acquire: ZIO[R, E, A], release: (Exit[Any, Any]) => URIO[R, Any]) extends Product with Serializable
A
Reservation[-R, +E, +A]encapsulates resource acquisition and disposal without specifying when or how that resource might be used.A
Reservation[-R, +E, +A]encapsulates resource acquisition and disposal without specifying when or how that resource might be used.See ZManaged#reserve and ZIO#reserve for details of usage.
- trait Runtime[+R] extends AnyRef
A
Runtime[R]is capable of executing tasks within an environmentR. - final case class RuntimeConfig(blockingExecutor: Executor, executor: Executor, tracing: Tracing, fatal: (Throwable) => Boolean, reportFatal: (Throwable) => Nothing, supervisor: Supervisor[Any], enableCurrentFiber: Boolean, logger: ZLogger[Any]) extends Product with Serializable
A
RuntimeConfigprovides the minimum capabilities necessary to bootstrap execution ofZIOtasks. - final case class RuntimeConfigAspect(customize: (RuntimeConfig) => RuntimeConfig) extends (RuntimeConfig) => RuntimeConfig with Product with Serializable
- trait Schedule[-Env, -In, +Out] extends Serializable
A
Schedule[Env, In, Out]defines a recurring schedule, which consumes values of typeIn, and which returns values of typeOut.A
Schedule[Env, In, Out]defines a recurring schedule, which consumes values of typeIn, and which returns values of typeOut.Schedules are defined as a possibly infinite set of intervals spread out over time. Each interval defines a window in which recurrence is possible.
When schedules are used to repeat or retry effects, the starting boundary of each interval produced by a schedule is used as the moment when the effect will be executed again.
Schedules compose in the following primary ways:
* Union. This performs the union of the intervals of two schedules. * Intersection. This performs the intersection of the intervals of two schedules. * Sequence. This concatenates the intervals of one schedule onto another.
In addition, schedule inputs and outputs can be transformed, filtered (to terminate a schedule early in response to some input or output), and so forth.
A variety of other operators exist for transforming and combining schedules, and the companion object for
Schedulecontains all common types of schedules, both for performing retrying, as well as performing repetition. - type Semaphore = TSemaphore
- abstract class Supervisor[+A] extends AnyRef
A
Supervisor[A]is allowed to supervise the launching and termination of fibers, producing some visible value of typeAfrom the supervision. - trait System extends Serializable
- type Tag[A] = izumi.reflect.Tag[A]
- Definition Classes
- VersionSpecific
- type TagK[F[_]] = HKTag[AnyRef { type Arg[A] = F[A] }]
- Definition Classes
- VersionSpecific
- type TagK10[F[_, _, _, _, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9] = F[A0,A1,A2,A3,A4,A5,A6,A7,A8,A9] }]
- Definition Classes
- VersionSpecific
- type TagK11[F[_, _, _, _, _, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10] = F[A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10] }]
- Definition Classes
- VersionSpecific
- type TagK12[F[_, _, _, _, _, _, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11] = F[A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11] }]
- Definition Classes
- VersionSpecific
- type TagK13[F[_, _, _, _, _, _, _, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12] = F[A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12] }]
- Definition Classes
- VersionSpecific
- type TagK14[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13] = F[A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13] }]
- Definition Classes
- VersionSpecific
- type TagK15[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14] = F[A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14] }]
- Definition Classes
- VersionSpecific
- type TagK16[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15] = F[A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15] }]
- Definition Classes
- VersionSpecific
- type TagK17[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16] = F[A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16] }]
- Definition Classes
- VersionSpecific
- type TagK18[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17] = F[A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17] }]
- Definition Classes
- VersionSpecific
- type TagK19[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18] = F[A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18] }]
- Definition Classes
- VersionSpecific
- type TagK20[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19] = F[A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19] }]
- Definition Classes
- VersionSpecific
- type TagK21[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20] = F[A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20] }]
- Definition Classes
- VersionSpecific
- type TagK22[F[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21] = F[A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21] }]
- Definition Classes
- VersionSpecific
- type TagK3[F[_, _, _]] = HKTag[AnyRef { type Arg[A, B, C] = F[A,B,C] }]
- Definition Classes
- VersionSpecific
- type TagK4[F[_, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3] = F[A0,A1,A2,A3] }]
- Definition Classes
- VersionSpecific
- type TagK5[F[_, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4] = F[A0,A1,A2,A3,A4] }]
- Definition Classes
- VersionSpecific
- type TagK6[F[_, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5] = F[A0,A1,A2,A3,A4,A5] }]
- Definition Classes
- VersionSpecific
- type TagK7[F[_, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6] = F[A0,A1,A2,A3,A4,A5,A6] }]
- Definition Classes
- VersionSpecific
- type TagK8[F[_, _, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6, A7] = F[A0,A1,A2,A3,A4,A5,A6,A7] }]
- Definition Classes
- VersionSpecific
- type TagK9[F[_, _, _, _, _, _, _, _, _]] = HKTag[AnyRef { type Arg[A0, A1, A2, A3, A4, A5, A6, A7, A8] = F[A0,A1,A2,A3,A4,A5,A6,A7,A8] }]
- Definition Classes
- VersionSpecific
- type TagKK[F[_, _]] = HKTag[AnyRef { type Arg[A, B] = F[A,B] }]
- Definition Classes
- VersionSpecific
- type Task[+A] = ZIO[Any, Throwable, A]
- type TaskLayer[+ROut] = ZLayer[Any, Throwable, ROut]
- type TaskManaged[+A] = ZManaged[Any, Throwable, A]
- sealed abstract class TracingStatus extends Serializable with Product
Whether ZIO Tracing is enabled for the current fiber in the current region.
- type UIO[+A] = ZIO[Any, Nothing, A]
- type ULayer[+ROut] = ZLayer[Any, Nothing, ROut]
- type UManaged[+A] = ZManaged[Any, Nothing, A]
- type URIO[-R, +A] = ZIO[R, Nothing, A]
- type URLayer[-RIn, +ROut] = ZLayer[RIn, Nothing, ROut]
- type URManaged[-R, +A] = ZManaged[R, Nothing, A]
- trait Unzippable[A, B] extends AnyRef
- trait UnzippableLowPriority1 extends UnzippableLowPriority2
- trait UnzippableLowPriority2 extends UnzippableLowPriority3
- trait UnzippableLowPriority3 extends AnyRef
- type ZDequeue[-R, +E, +A] = ZQueue[Nothing, R, Any, E, Nothing, A]
A queue that can only be dequeued.
- type ZEnqueue[-R, +E, -A] = ZQueue[R, Nothing, E, Any, A, Any]
A queue that can only be enqueued.
- type ZEnv = Has[Clock] with Has[Console] with Has[System] with Has[Random]
- Definition Classes
- PlatformSpecific
- sealed abstract class ZFiberRef[+EA, +EB, -A, +B] extends Serializable
A
FiberRefis ZIO's equivalent of Java'sThreadLocal.A
FiberRefis ZIO's equivalent of Java'sThreadLocal. The value of aFiberRefis automatically propagated to child fibers when they are forked and merged back in to the value of the parent fiber after they are joined.for { fiberRef <- FiberRef.make("Hello world!") child <- fiberRef.set("Hi!).fork result <- child.join } yield result
Here
resultwill be equal to "Hi!" since changed made by a child fiber are merged back in to the value of the parent fiber on join.By default the value of the child fiber will replace the value of the parent fiber on join but you can specify your own logic for how values should be merged.
for { fiberRef <- FiberRef.make(0, math.max) child <- fiberRef.update(_ + 1).fork _ <- fiberRef.update(_ + 2) _ <- child.join value <- fiberRef.get } yield value
Here
valuewill be 2 as the value in the joined fiber is lower and we specifiedmaxas our combining function. - sealed abstract class ZHub[-RA, -RB, +EA, +EB, -A, +B] extends Serializable
A
ZHub[RA, RB, EA, EB, A, B]is an asynchronous message hub.A
ZHub[RA, RB, EA, EB, A, B]is an asynchronous message hub. Publishers can publish messages of typeAto the hub and subscribers can subscribe to take messages of typeBfrom the hub. Publishing messages can require an environment of typeRAand fail with an error of typeEA. Taking messages can require an environment of typeRBand fail with an error of typeEB. - sealed trait ZIO[-R, +E, +A] extends Serializable with ZIOPlatformSpecific[R, E, A] with ZIOVersionSpecific[R, E, A]
A
ZIO[R, E, A]value is an immutable value that lazily describes a workflow or job.A
ZIO[R, E, A]value is an immutable value that lazily describes a workflow or job. The workflow requires some environmentR, and may fail with an error of typeE, or succeed with a value of typeA.These lazy workflows, referred to as _effects_, can be informally thought of as functions in the form:
R => Either[E, A]ZIO effects model resourceful interaction with the outside world, including synchronous, asynchronous, concurrent, and parallel interaction.
ZIO effects use a fiber-based concurrency model, with built-in support for scheduling, fine-grained interruption, structured concurrency, and high scalability.
To run an effect, you need a
Runtime, which is capable of executing effects. Runtimes bundle a thread pool together with the environment that effects need. - trait ZIOApp extends AnyRef
An entry point for a ZIO application that allows sharing layers between applications.
An entry point for a ZIO application that allows sharing layers between applications. For a simpler version that uses the default ZIO environment see
ZIOAppDefault. - final case class ZIOAppArgs(args: Chunk[String]) extends Product with Serializable
A service that contains command-line arguments of an application.
- trait ZIOAppDefault extends ZIOApp
The entry point for a ZIO application.
The entry point for a ZIO application.
import zio.ZIOApp import zio.Console._ object MyApp extends ZIOAppDefault { def run = for { _ <- printLine("Hello! What is your name?") n <- readLine _ <- printLine("Hello, " + n + ", good to meet you!") } yield () }
- trait ZIOAspect[+LowerR, -UpperR, +LowerE, -UpperE, +LowerA, -UpperA] extends AnyRef
- sealed trait ZIOMetric[-A] extends ZIOAspect[Nothing, Any, Nothing, Any, Nothing, A]
A
ZIOMetricis able to add collection of metrics to aZIOeffect without changing its environment or error types.A
ZIOMetricis able to add collection of metrics to aZIOeffect without changing its environment or error types. Aspects are the idiomatic way of adding collection of metrics to effects. - sealed abstract class ZLayer[-RIn, +E, +ROut] extends AnyRef
A
ZLayer[A, E, B]describes a layer of an application: every layer in an application requires some services (the input) and produces some services (the output).A
ZLayer[A, E, B]describes a layer of an application: every layer in an application requires some services (the input) and produces some services (the output).Layers can be thought of as recipes for producing bundles of services, given their dependencies (other services).
Construction of layers can be effectful and utilize resources that must be acquired and safely released when the services are done being utilized.
By default layers are shared, meaning that if the same layer is used twice the layer will only be allocated a single time.
Because of their excellent composition properties, layers are the idiomatic way in ZIO to create services that depend on other services.
- trait ZLogger[+A] extends AnyRef
- sealed abstract class ZManaged[-R, +E, +A] extends ZManagedVersionSpecific[R, E, A] with Serializable
A
ZManaged[R, E, A]is a managed resource of typeA, which may be used by invoking theusemethod of the resource.A
ZManaged[R, E, A]is a managed resource of typeA, which may be used by invoking theusemethod of the resource. The resource will be automatically acquired before the resource is used, and automatically released after the resource is used.Resources do not survive the scope of
use, meaning that if you attempt to capture the resource, leak it fromuse, and then use it after the resource has been consumed, the resource will not be valid anymore and may fail with some checked error, as per the type of the functions provided by the resource. - trait ZManagedAspect[+LowerR, -UpperR, +LowerE, -UpperE, +LowerA, -UpperA] extends AnyRef
- abstract class ZQueue[-RA, -RB, +EA, +EB, -A, +B] extends Serializable
A
ZQueue[RA, RB, EA, EB, A, B]is a lightweight, asynchronous queue into which values of typeAcan be enqueued and of which elements of typeBcan be dequeued.A
ZQueue[RA, RB, EA, EB, A, B]is a lightweight, asynchronous queue into which values of typeAcan be enqueued and of which elements of typeBcan be dequeued. The queue's enqueueing operations may utilize an environment of typeRAand may fail with errors of typeEA. The dequeueing operations may utilize an environment of typeRBand may fail with errors of typeEB. - sealed abstract class ZRef[-RA, -RB, +EA, +EB, -A, +B] extends Serializable
A
ZRef[RA, RB, EA, EB, A, B]is a polymorphic, purely functional description of a mutable reference.A
ZRef[RA, RB, EA, EB, A, B]is a polymorphic, purely functional description of a mutable reference. The fundamental operations of aZRefaresetandget.settakes a value of typeAand sets the reference to a new value, requiring an environment of typeRAand potentially failing with an error of typeEA.getgets the current value of the reference and returns a value of typeB, requiring an environment of typeRBand potentially failing with an error of typeEB.When the error and value types of the
ZRefare unified, that is, it is aZRef[R, R, E, E, A, A], theZRefalso supports atomicmodifyandupdateoperations. All operations are guaranteed to be safe for concurrent access.By default,
ZRefis implemented in terms of compare and swap operations for maximum performance and does not support performing effects within update operations. If you need to perform effects within update operations you can create aZRef.Synchronized, a specialized type ofZRefthat supports performing effects within update operations at some cost to performance. In this case writes will semantically block other writers, while multiple readers can read simultaneously.ZRef.Synchronizedalso supports composing multipleZRef.Synchronizedvalues together to form a singleZRef.Synchronizedvalue that can be atomically updated using thezipoperator. In this case reads and writes will semantically block other readers and writers.NOTE: While
ZRefprovides the functional equivalent of a mutable reference, the value inside theZRefshould normally be immutable since compare and swap operations are not safe for mutable values that do not support concurrent access. If you do need to use a mutable valueZRef.Synchronizedwill guarantee that access to the value is properly synchronized. - sealed abstract class ZScope[+A] extends AnyRef
A
ZScope[A]is a value that allows adding finalizers identified by a key.A
ZScope[A]is a value that allows adding finalizers identified by a key. Scopes are closed with a value of typeA, which is provided to all the finalizers when the scope is released.For safety reasons, this interface has no method to close a scope. Rather, an open scope may be required with
ZScope.make, which returns a function that can close a scope. This allows scopes to be safely passed around without fear they will be accidentally closed. - sealed trait ZState[S] extends AnyRef
ZState[S]models a value of typeSthat can be read from and written to during the execution of an effect.ZState[S]models a value of typeSthat can be read from and written to during the execution of an effect. The idiomatic way to work withZStateis as part of the environment using operators defined onZIO. For example:final case class MyState(counter: Int) for { _ <- ZIO.updateState[MyState](state => state.copy(counter = state.counter + 1)) count <- ZIO.getStateWith[MyState](_.counter) } yield count
Because
ZStateis typically used as part of the environment, it is recommended to define your own state typeSsuch asMyStateabove rather than using a type such asIntto avoid the risk of ambiguity.To run an effect that depends on some state, create the initial state with the
makeconstructor and then usetoLayerto convert it into a layer that you can provide along with your application's other dependencies. - final case class ZTrace(fiberId: FiberId, executionTrace: List[ZTraceElement], stackTrace: List[ZTraceElement], parentTrace: Option[ZTrace]) extends Product with Serializable
- trait Zippable[-A, -B] extends AnyRef
- trait ZippableLowPriority1 extends ZippableLowPriority2
- trait ZippableLowPriority2 extends ZippableLowPriority3
- trait ZippableLowPriority3 extends AnyRef
Deprecated Type Members
- trait App extends ZApp[ZEnv] with BootstrapRuntime
- Annotations
- @deprecated
- Deprecated
(Since version Use zio.ZIOApp) 2.0.0
- trait BootstrapRuntime extends ZBootstrapRuntime[ZEnv]
- Annotations
- @deprecated
- Deprecated
(Since version Use zio.Runtime) 2.0.0
- type ERefM[+E, A] = Synchronized[Any, Any, E, E, A, A]
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use ERef.Synchronized
- trait ManagedApp extends BootstrapRuntime
- Annotations
- @deprecated
- Deprecated
(Since version Use zio.ZIOApp and use the managed inside
run) 2.0.0
- type RefM[A] = Synchronized[Any, Any, Nothing, Nothing, A, A]
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use Ref.Synchronized
- trait ZApp[R] extends Runtime[R]
- Annotations
- @deprecated
- Deprecated
(Since version Use zio.ZIOApp) 2.0.0
- trait ZBootstrapRuntime[R] extends Runtime[R]
- Annotations
- @deprecated
- Deprecated
(Since version Use Runtime) 2.0.0
- type ZRefM[-RA, -RB, +EA, +EB, -A, +B] = Synchronized[RA, RB, EA, EB, A, B]
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use ZRef.Synchronized
Value Members
- val ERef: ZRef.type
- val FiberRef: ZFiberRef.type
- val Hub: ZHub.type
- val Managed: ZManaged.type
- val Queue: ZQueue.type
- lazy val Tag: izumi.reflect.Tag.type
- Definition Classes
- VersionSpecific
- lazy val TagK: izumi.reflect.TagK.type
- Definition Classes
- VersionSpecific
- lazy val TagK3: izumi.reflect.TagK3.type
- Definition Classes
- VersionSpecific
- lazy val TagKK: izumi.reflect.TagKK.type
- Definition Classes
- VersionSpecific
- implicit def buildFromNothing[A, Collection[+Element] <: Iterable[Element] with IterableOps[A, Collection, _]]: BuildFrom[Collection[A], Nothing, Collection[Nothing]]
- Definition Classes
- BuildFromCompat
- implicit def duration2DurationOps(duration: Duration): DurationOps
- Definition Classes
- DurationModule
- implicit def durationInt(n: Int): DurationSyntax
- Definition Classes
- DurationModule
- implicit def durationLong(n: Long): DurationSyntax
- Definition Classes
- DurationModule
- implicit val durationOrdering: Ordering[Duration]
- Definition Classes
- DurationModule
- object =!= extends Serializable
- object Accessible
- case object BuildInfo extends Product with Serializable
This object was generated by sbt-buildinfo.
- object CanFail extends CanFail[Any]
- object Cause extends Serializable
- object Chunk extends ChunkFactory with ChunkPlatformSpecific
- object ChunkBuilder
- object ChunkLike extends SeqFactory[Chunk]
- object Clock extends ClockPlatformSpecific with Serializable
- object Console extends Serializable
- object Duration
- object ExecutionStrategy
- object Executor extends DefaultExecutors with Serializable
- object Exit extends Serializable
- object ExitCode extends Serializable
- object Fiber extends FiberPlatformSpecific
- object FiberId extends Serializable
- object Has extends Serializable
- object IO
- object InterruptStatus extends Serializable
- object IsSubtypeOfError extends Serializable
- object IsSubtypeOfOutput extends Serializable
- object LogLevel extends Serializable
- object NeedsEnv extends NeedsEnv[Nothing]
- object NonEmptyChunk
- object Promise extends Serializable
- object RIO
- object Random extends Serializable
- object Ref extends Serializable
- object Runtime
- object RuntimeConfig extends RuntimeConfigPlatformSpecific with Serializable
- object RuntimeConfigAspect extends ((RuntimeConfig) => RuntimeConfig) => RuntimeConfigAspect with Serializable
- object Schedule extends Serializable
- object Semaphore
- object Supervisor
- object System extends Serializable
- object Task extends TaskPlatformSpecific
- object TracingStatus extends Serializable
- object UIO
- object URIO
- object Unzippable extends UnzippableLowPriority1
- object ZEnv
- Definition Classes
- PlatformSpecific
- object ZFiberRef extends Serializable
- object ZHub extends Serializable
- object ZIO extends ZIOCompanionPlatformSpecific with Serializable
- object ZIOApp
- object ZIOAppDefault
- object ZIOAspect
- object ZIOMetric
- object ZLayer extends ZLayerCompanionVersionSpecific
- object ZLogger
- object ZManaged extends ZManagedPlatformSpecific with Serializable
- object ZQueue extends Serializable
- object ZRef extends Serializable
- object ZScope
- object ZState
- object ZTrace extends Serializable
- object Zippable extends ZippableLowPriority1
Deprecated Value Members
- def buildFromAny[Element, Collection[+Element] <: Iterable[Element] with IterableOps[Any, Collection, Any]]: BuildFrom[Collection[Any], Element, Collection[Element]]
- Definition Classes
- BuildFromCompat
- Annotations
- @deprecated
- Deprecated
(Since version 1.0.6) Use BuildFrom.buildFromIterableOps or buildFromNothing instead
- object RefM
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use Ref.Synchronized
- object ZRefM
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use ZRef.Synchronized