class ZStream[-R, +E, +A] extends AnyRef
- Self Type
- ZStream[R, E, A]
- Alphabetic
- By Inheritance
- ZStream
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def &>[R1 <: R, E1 >: E, A2](that: ZStream[R1, E1, A2]): ZStream[R1, E1, A2]
Symbolic alias for ZStream#zipRight.
- final def *>[R1 <: R, E1 >: E, A2](that: ZStream[R1, E1, A2]): ZStream[R1, E1, A2]
Symbolic alias for ZStream#crossRight.
- def ++[R1 <: R, E1 >: E, A1 >: A](that: => ZStream[R1, E1, A1]): ZStream[R1, E1, A1]
Symbolic alias for ZStream#concat.
- final def <&[R1 <: R, E1 >: E, A2](that: ZStream[R1, E1, A2]): ZStream[R1, E1, A]
Symbolic alias for ZStream#zipLeft.
- final def <&>[R1 <: R, E1 >: E, A2](that: ZStream[R1, E1, A2])(implicit zippable: Zippable[A, A2]): ZStream[R1, E1, Out]
Symbolic alias for ZStream#zip.
- final def <*[R1 <: R, E1 >: E, A2](that: ZStream[R1, E1, A2]): ZStream[R1, E1, A]
Symbolic alias for ZStream#crossLeft.
- final def <*>[R1 <: R, E1 >: E, A2](that: ZStream[R1, E1, A2])(implicit zippable: Zippable[A, A2]): ZStream[R1, E1, Out]
Symbolic alias for ZStream#cross.
- final def <>[R1 <: R, E2, A1 >: A](that: => ZStream[R1, E2, A1])(implicit ev: CanFail[E]): ZStream[R1, E2, A1]
Symbolic alias for ZStream#orElse.
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def >>>[R1 <: R, E2, A2 >: A, Z](sink: ZSink[R1, E, A2, E2, Any, Z]): ZIO[R1, E2, Z]
Symbolic alias for zio.stream.ZStream!.run[R1<:R,E1>:E,B]*.
- final def @@[LowerR <: UpperR, UpperR <: R, LowerE >: E, UpperE >: LowerE, LowerA >: A, UpperA >: LowerA](aspect: ZStreamAspect[LowerR, UpperR, LowerE, UpperE, LowerA, UpperA]): ZStream[UpperR, LowerE, LowerA]
Syntax for adding aspects.
- final def absolve[R1 <: R, E1, A1](implicit ev: <:<[ZStream[R, E, A], ZStream[R1, E1, Either[E1, A1]]]): ZStream[R1, E1, A1]
Returns a stream that submerges the error case of an
Eitherinto theZStream. - final def aggregateAsync[R1 <: R, E1 >: E, E2, A1 >: A, B](sink: ZSink[R1, E1, A1, E2, A1, B]): ZStream[R1 with Has[Clock], E2, B]
Aggregates elements of this stream using the provided sink for as long as the downstream operators on the stream are busy.
Aggregates elements of this stream using the provided sink for as long as the downstream operators on the stream are busy.
This operator divides the stream into two asynchronous "islands". Operators upstream of this operator run on one fiber, while downstream operators run on another. Whenever the downstream fiber is busy processing elements, the upstream fiber will feed elements into the sink until it signals completion.
Any sink can be used here, but see ZSink.foldWeightedM and ZSink.foldUntilM for sinks that cover the common usecases.
- final def aggregateAsyncWithin[R1 <: R, E1 >: E, E2, A1 >: A, B](sink: ZSink[R1, E1, A1, E2, A1, B], schedule: Schedule[R1, Option[B], Any]): ZStream[R1 with Has[Clock], E2, B]
Like
aggregateAsyncWithinEither, but only returns theRightresults.Like
aggregateAsyncWithinEither, but only returns theRightresults.- sink
used for the aggregation
- schedule
signalling for when to stop the aggregation
- returns
ZStream[R1 with Has[Clock], E2, B]
- def aggregateAsyncWithinEither[R1 <: R, E1 >: E, A1 >: A, E2, B, C](sink: ZSink[R1, E1, A1, E2, A1, B], schedule: Schedule[R1, Option[B], C]): ZStream[R1 with Has[Clock], E2, Either[C, B]]
Aggregates elements using the provided sink until it completes, or until the delay signalled by the schedule has passed.
Aggregates elements using the provided sink until it completes, or until the delay signalled by the schedule has passed.
This operator divides the stream into two asynchronous islands. Operators upstream of this operator run on one fiber, while downstream operators run on another. Elements will be aggregated by the sink until the downstream fiber pulls the aggregated value, or until the schedule's delay has passed.
Aggregated elements will be fed into the schedule to determine the delays between pulls.
- sink
used for the aggregation
- schedule
signalling for when to stop the aggregation
- returns
ZStream[R1 with Has[Clock], E2, Either[C, B]]
- def as[A2](A2: => A2): ZStream[R, E, A2]
Maps the success values of this stream to the specified constant value.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def bimap[E1, A1](f: (E) => E1, g: (A) => A1)(implicit ev: CanFail[E]): ZStream[R, E1, A1]
Returns a stream whose failure and success channels have been mapped by the specified pair of functions,
fandg. - final def broadcast(n: Int, maximumLag: Int): ZManaged[R, Nothing, List[ZStream[Any, E, A]]]
Fan out the stream, producing a list of streams that have the same elements as this stream.
Fan out the stream, producing a list of streams that have the same elements as this stream. The driver stream will only ever advance the
maximumLagchunks before the slowest downstream stream. - final def broadcastDynamic(maximumLag: Int): ZManaged[R, Nothing, ZStream[Any, E, A]]
Fan out the stream, producing a dynamic number of streams that have the same elements as this stream.
Fan out the stream, producing a dynamic number of streams that have the same elements as this stream. The driver stream will only ever advance the
maximumLagchunks before the slowest downstream stream. - final def broadcastedQueues(n: Int, maximumLag: Int): ZManaged[R, Nothing, List[Dequeue[Take[E, A]]]]
Converts the stream to a managed list of queues.
Converts the stream to a managed list of queues. Every value will be replicated to every queue with the slowest queue being allowed to buffer
maximumLagchunks before the driver is back pressured.Queues can unsubscribe from upstream by shutting down.
- final def broadcastedQueuesDynamic(maximumLag: Int): ZManaged[R, Nothing, ZManaged[Any, Nothing, Dequeue[Take[E, A]]]]
Converts the stream to a managed dynamic amount of queues.
Converts the stream to a managed dynamic amount of queues. Every chunk will be replicated to every queue with the slowest queue being allowed to buffer
maximumLagchunks before the driver is back pressured.Queues can unsubscribe from upstream by shutting down.
- final def buffer(capacity: Int): ZStream[R, E, A]
Allows a faster producer to progress independently of a slower consumer by buffering up to
capacityelements in a queue.Allows a faster producer to progress independently of a slower consumer by buffering up to
capacityelements in a queue.- Note
This combinator destroys the chunking structure. It's recommended to use chunkN afterwards.
,Prefer capacities that are powers of 2 for better performance.
- final def bufferChunks(capacity: Int): ZStream[R, E, A]
Allows a faster producer to progress independently of a slower consumer by buffering up to
capacitychunks in a queue.Allows a faster producer to progress independently of a slower consumer by buffering up to
capacitychunks in a queue.- Note
Prefer capacities that are powers of 2 for better performance.
- final def bufferChunksDropping(capacity: Int): ZStream[R, E, A]
Allows a faster producer to progress independently of a slower consumer by buffering up to
capacitychunks in a dropping queue.Allows a faster producer to progress independently of a slower consumer by buffering up to
capacitychunks in a dropping queue.- Note
Prefer capacities that are powers of 2 for better performance.
- final def bufferChunksSliding(capacity: Int): ZStream[R, E, A]
Allows a faster producer to progress independently of a slower consumer by buffering up to
capacitychunks in a sliding queue.Allows a faster producer to progress independently of a slower consumer by buffering up to
capacitychunks in a sliding queue.- Note
Prefer capacities that are powers of 2 for better performance.
- final def bufferDropping(capacity: Int): ZStream[R, E, A]
Allows a faster producer to progress independently of a slower consumer by buffering up to
capacityelements in a dropping queue.Allows a faster producer to progress independently of a slower consumer by buffering up to
capacityelements in a dropping queue.- Note
This combinator destroys the chunking structure. It's recommended to use chunkN afterwards.
,Prefer capacities that are powers of 2 for better performance.
- final def bufferSliding(capacity: Int): ZStream[R, E, A]
Allows a faster producer to progress independently of a slower consumer by buffering up to
capacityelements in a sliding queue.Allows a faster producer to progress independently of a slower consumer by buffering up to
capacityelements in a sliding queue.- Note
This combinator destroys the chunking structure. It's recommended to use chunkN afterwards.
,Prefer capacities that are powers of 2 for better performance.
- final def bufferUnbounded: ZStream[R, E, A]
Allows a faster producer to progress independently of a slower consumer by buffering chunks into an unbounded queue.
- final def catchAll[R1 <: R, E2, A1 >: A](f: (E) => ZStream[R1, E2, A1])(implicit ev: CanFail[E]): ZStream[R1, E2, A1]
Switches over to the stream produced by the provided function in case this one fails with a typed error.
- final def catchAllCause[R1 <: R, E2, A1 >: A](f: (Cause[E]) => ZStream[R1, E2, A1]): ZStream[R1, E2, A1]
Switches over to the stream produced by the provided function in case this one fails.
Switches over to the stream produced by the provided function in case this one fails. Allows recovery from all causes of failure, including interruption if the stream is uninterruptible.
- final def catchSome[R1 <: R, E1 >: E, A1 >: A](pf: PartialFunction[E, ZStream[R1, E1, A1]]): ZStream[R1, E1, A1]
Switches over to the stream produced by the provided function in case this one fails with some typed error.
- final def catchSomeCause[R1 <: R, E1 >: E, A1 >: A](pf: PartialFunction[Cause[E], ZStream[R1, E1, A1]]): ZStream[R1, E1, A1]
Switches over to the stream produced by the provided function in case this one fails with some errors.
Switches over to the stream produced by the provided function in case this one fails with some errors. Allows recovery from all causes of failure, including interruption if the stream is uninterruptible.
- def changes: ZStream[R, E, A]
Returns a new stream that only emits elements that are not equal to the previous element emitted, using natural equality to determine whether two elements are equal.
- def changesWith(f: (A, A) => Boolean): ZStream[R, E, A]
Returns a new stream that only emits elements that are not equal to the previous element emitted, using the specified function to determine whether two elements are equal.
- val channel: ZChannel[R, Any, Any, Any, E, Chunk[A], Any]
- def chunkN(n: Int): ZStream[R, E, A]
Re-chunks the elements of the stream into chunks of
nelements each.Re-chunks the elements of the stream into chunks of
nelements each. The last chunk might contain less thannelements - def chunks: ZStream[R, E, Chunk[A]]
Exposes the underlying chunks of the stream as a stream of chunks of elements
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def collect[B](f: PartialFunction[A, B]): ZStream[R, E, B]
Performs a filter and map in a single step.
- final def collectLeft[L1, A1](implicit ev: <:<[A, Either[L1, A1]]): ZStream[R, E, L1]
Filters any
Rightvalues. - final def collectRight[L1, A1](implicit ev: <:<[A, Either[L1, A1]]): ZStream[R, E, A1]
Filters any
Leftvalues. - final def collectSome[A1](implicit ev: <:<[A, Option[A1]]): ZStream[R, E, A1]
Filters any 'None' values.
- final def collectSuccess[L1, A1](implicit ev: <:<[A, Exit[L1, A1]]): ZStream[R, E, A1]
Filters any
Exit.Failurevalues. - def collectWhile[A1](pf: PartialFunction[A, A1]): ZStream[R, E, A1]
Transforms all elements of the stream for as long as the specified partial function is defined.
- final def collectWhileLeft[L1, A1](implicit ev: <:<[A, Either[L1, A1]]): ZStream[R, E, L1]
Terminates the stream when encountering the first
Right. - final def collectWhileRight[L1, A1](implicit ev: <:<[A, Either[L1, A1]]): ZStream[R, E, A1]
Terminates the stream when encountering the first
Left. - final def collectWhileSome[A1](implicit ev: <:<[A, Option[A1]]): ZStream[R, E, A1]
Terminates the stream when encountering the first
None. - final def collectWhileSuccess[L1, A1](implicit ev: <:<[A, Exit[L1, A1]]): ZStream[R, E, A1]
Terminates the stream when encountering the first
Exit.Failure. - final def collectWhileZIO[R1 <: R, E1 >: E, A1](pf: PartialFunction[A, ZIO[R1, E1, A1]]): ZStream[R1, E1, A1]
Effectfully transforms all elements of the stream for as long as the specified partial function is defined.
- final def collectZIO[R1 <: R, E1 >: E, A1](pf: PartialFunction[A, ZIO[R1, E1, A1]]): ZStream[R1, E1, A1]
Performs an effectful filter and map in a single step.
- final def combine[R1 <: R, E1 >: E, S, A2, A3](that: ZStream[R1, E1, A2])(s: S)(f: (S, ZIO[R, Option[E], A], ZIO[R1, Option[E1], A2]) => ZIO[R1, Nothing, Exit[Option[E1], (A3, S)]]): ZStream[R1, E1, A3]
Combines the elements from this stream and the specified stream by repeatedly applying the function
fto extract an element using both sides and conceptually "offer" it to the destination stream.Combines the elements from this stream and the specified stream by repeatedly applying the function
fto extract an element using both sides and conceptually "offer" it to the destination stream.fcan maintain some internal state to control the combining process, with the initial state being specified bys.Where possible, prefer ZStream#combineChunks for a more efficient implementation.
- final def combineChunks[R1 <: R, E1 >: E, S, A2, A3](that: ZStream[R1, E1, A2])(s: S)(f: (S, ZIO[R, Option[E], Chunk[A]], ZIO[R1, Option[E1], Chunk[A2]]) => ZIO[R1, Nothing, Exit[Option[E1], (Chunk[A3], S)]]): ZStream[R1, E1, A3]
Combines the chunks from this stream and the specified stream by repeatedly applying the function
fto extract a chunk using both sides and conceptually "offer" it to the destination stream.Combines the chunks from this stream and the specified stream by repeatedly applying the function
fto extract a chunk using both sides and conceptually "offer" it to the destination stream.fcan maintain some internal state to control the combining process, with the initial state being specified bys. - def concat[R1 <: R, E1 >: E, A1 >: A](that: => ZStream[R1, E1, A1]): ZStream[R1, E1, A1]
Concatenates the specified stream with this stream, resulting in a stream that emits the elements from this stream and then the elements from the specified stream.
- final def cross[R1 <: R, E1 >: E, B](that: => ZStream[R1, E1, B])(implicit zippable: Zippable[A, B]): ZStream[R1, E1, Out]
Composes this stream with the specified stream to create a cartesian product of elements.
Composes this stream with the specified stream to create a cartesian product of elements. The
thatstream would be run multiple times, for every element in thethisstream.See also ZStream#zip and ZStream#<&> for the more common point-wise variant.
- final def crossLeft[R1 <: R, E1 >: E, B](that: => ZStream[R1, E1, B]): ZStream[R1, E1, A]
Composes this stream with the specified stream to create a cartesian product of elements, but keeps only elements from this stream.
Composes this stream with the specified stream to create a cartesian product of elements, but keeps only elements from this stream. The
thatstream would be run multiple times, for every element in thethisstream.See also ZStream#zip and ZStream#<&> for the more common point-wise variant.
- def crossRight[R1 <: R, E1 >: E, B](that: => ZStream[R1, E1, B]): ZStream[R1, E1, B]
Composes this stream with the specified stream to create a cartesian product of elements, but keeps only elements from the other stream.
Composes this stream with the specified stream to create a cartesian product of elements, but keeps only elements from the other stream. The
thatstream would be run multiple times, for every element in thethisstream.See also ZStream#zip and ZStream#<&> for the more common point-wise variant.
- final def crossWith[R1 <: R, E1 >: E, A2, C](that: ZStream[R1, E1, A2])(f: (A, A2) => C): ZStream[R1, E1, C]
Composes this stream with the specified stream to create a cartesian product of elements with a specified function.
Composes this stream with the specified stream to create a cartesian product of elements with a specified function. The
thatstream would be run multiple times, for every element in thethisstream.See also ZStream#zip and ZStream#<&> for the more common point-wise variant.
- final def debounce(d: zio.Duration): ZStream[R with Has[Clock], E, A]
Delays the emission of values by holding new values for a set duration.
Delays the emission of values by holding new values for a set duration. If no new values arrive during that time the value is emitted, however if a new value is received during the holding period the previous value is discarded and the process is repeated with the new value.
This operator is useful if you have a stream of "bursty" events which eventually settle down and you only need the final event of the burst.
A search engine may only want to initiate a search after a user has paused typing so as to not prematurely recommend results.
Example: - final def defaultIfEmpty[R1 <: R, E1 >: E, A1 >: A](stream: ZStream[R1, E1, A1]): ZStream[R1, E1, A1]
Switches to the provided stream in case this one is empty.
- final def defaultIfEmpty[A1 >: A](chunk: Chunk[A1]): ZStream[R, E, A1]
Produces the specified chunk if this stream is empty.
- final def defaultIfEmpty[A1 >: A](a: A1): ZStream[R, E, A1]
Produces the specified element if this stream is empty.
- final def distributedWith[E1 >: E](n: Int, maximumLag: Int, decide: (A) => UIO[(Int) => Boolean]): ZManaged[R, Nothing, List[Dequeue[Exit[Option[E1], A]]]]
More powerful version of
ZStream#broadcast.More powerful version of
ZStream#broadcast. Allows to provide a function that determines what queues should receive which elements. The decide function will receive the indices of the queues in the resulting list. - final def distributedWithDynamic(maximumLag: Int, decide: (A) => UIO[(UniqueKey) => Boolean], done: (Exit[Option[E], Nothing]) => UIO[Any] = (_: Any) => UIO.unit): ZManaged[R, Nothing, UIO[(UniqueKey, Dequeue[Exit[Option[E], A]])]]
More powerful version of
ZStream#distributedWith.More powerful version of
ZStream#distributedWith. This returns a function that will produce new queues and corresponding indices. You can also provide a function that will be executed after the final events are enqueued in all queues. Shutdown of the queues is handled by the driver. Downstream users can also shutdown queues manually. In this case the driver will continue but no longer backpressure on them. - final def drain: ZStream[R, E, Nothing]
Converts this stream to a stream that executes its effects but emits no elements.
Converts this stream to a stream that executes its effects but emits no elements. Useful for sequencing effects using streams:
(Stream(1, 2, 3).tap(i => ZIO(println(i))) ++ Stream.fromEffect(ZIO(println("Done!"))).drain ++ Stream(4, 5, 6).tap(i => ZIO(println(i)))).run(Sink.drain)
- final def drainFork[R1 <: R, E1 >: E](other: ZStream[R1, E1, Any]): ZStream[R1, E1, A]
Drains the provided stream in the background for as long as this stream is running.
Drains the provided stream in the background for as long as this stream is running. If this stream ends before
other,otherwill be interrupted. Ifotherfails, this stream will fail with that error. - def drop(n: Int): ZStream[R, E, A]
Drops the specified number of elements from this stream.
- def dropRight(n: Int): ZStream[R, E, A]
Drops the last specified number of elements from this stream.
Drops the last specified number of elements from this stream.
- Note
This combinator keeps
nelements in memory. Be careful with big numbers.
- final def dropUntil(pred: (A) => Boolean): ZStream[R, E, A]
Drops all elements of the stream until the specified predicate evaluates to
true. - final def dropWhile(f: (A) => Boolean): ZStream[R, E, A]
Drops all elements of the stream for as long as the specified predicate evaluates to
true. - final def either(implicit ev: CanFail[E]): ZStream[R, Nothing, Either[E, A]]
Returns a stream whose failures and successes have been lifted into an
Either.Returns a stream whose failures and successes have been lifted into an
Either. The resulting stream cannot fail, because the failures have been exposed as part of theEithersuccess case.- Note
the stream will end as soon as the first error occurs.
- final def ensuring[R1 <: R](fin: ZIO[R1, Nothing, Any]): ZStream[R1, E, A]
Executes the provided finalizer after this stream's finalizers run.
- final def ensuringFirst[R1 <: R](fin: ZIO[R1, Nothing, Any]): ZStream[R1, E, A]
Executes the provided finalizer before this stream's finalizers run.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def filter(f: (A) => Boolean): ZStream[R, E, A]
Filters the elements emitted by this stream using the provided function.
- final def filterNot(pred: (A) => Boolean): ZStream[R, E, A]
Filters this stream by the specified predicate, removing all elements for which the predicate evaluates to true.
- def filterZIO[R1 <: R, E1 >: E](f: (A) => ZIO[R1, E1, Boolean]): ZStream[R1, E1, A]
Effectfully filters the elements emitted by this stream.
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def find(f: (A) => Boolean): ZStream[R, E, A]
Finds the first element emitted by this stream that satisfies the provided predicate.
- final def findZIO[R1 <: R, E1 >: E, S](f: (A) => ZIO[R1, E1, Boolean]): ZStream[R1, E1, A]
Finds the first element emitted by this stream that satisfies the provided effectful predicate.
- final def fixed(duration: zio.Duration): ZStream[R with Has[Clock], E, A]
Emits elements of this stream with a fixed delay in between, regardless of how long it takes to produce a value.
- final def flatMap[R1 <: R, E1 >: E, B](f: (A) => ZStream[R1, E1, B]): ZStream[R1, E1, B]
Returns a stream made of the concatenation in strict order of all the streams produced by passing each element of this stream to
f0 - def flatMapPar[R1 <: R, E1 >: E, B](n: Long)(f: (A) => ZStream[R1, E1, B]): ZStream[R1, E1, B]
Maps each element of this stream to another stream and returns the non-deterministic merge of those streams, executing up to
ninner streams concurrently.Maps each element of this stream to another stream and returns the non-deterministic merge of those streams, executing up to
ninner streams concurrently. Up tooutputBufferelements of the produced streams may be buffered in memory by this operator. - final def flatMapParSwitch[R1 <: R, E1 >: E, A2](n: Int, bufferSize: Int = 16)(f: (A) => ZStream[R1, E1, A2]): ZStream[R1, E1, A2]
Maps each element of this stream to another stream and returns the non-deterministic merge of those streams, executing up to
ninner streams concurrently.Maps each element of this stream to another stream and returns the non-deterministic merge of those streams, executing up to
ninner streams concurrently. When a new stream is created from an element of the source stream, the oldest executing stream is cancelled. Up tobufferSizeelements of the produced streams may be buffered in memory by this operator. - def flatten[R1 <: R, E1 >: E, A1](implicit ev: <:<[A, ZStream[R1, E1, A1]]): ZStream[R1, E1, A1]
Flattens this stream-of-streams into a stream made of the concatenation in strict order of all the streams.
- def flattenChunks[A1](implicit ev: <:<[A, Chunk[A1]]): ZStream[R, E, A1]
Submerges the chunks carried by this stream into the stream's structure, while still preserving them.
- def flattenExit[E1 >: E, A1](implicit ev: <:<[A, Exit[E1, A1]]): ZStream[R, E1, A1]
Flattens Exit values.
Flattens Exit values.
Exit.Failurevalues translate to stream failures whileExit.Successvalues translate to stream elements. - def flattenExitOption[E1 >: E, A1](implicit ev: <:<[A, Exit[Option[E1], A1]]): ZStream[R, E1, A1]
Unwraps Exit values that also signify end-of-stream by failing with
None.Unwraps Exit values that also signify end-of-stream by failing with
None.For
Exit[E, A]values that do not signal end-of-stream, prefer:stream.mapZIO(ZIO.done(_))
- def flattenIterables[A1](implicit ev: <:<[A, Iterable[A1]]): ZStream[R, E, A1]
Submerges the iterables carried by this stream into the stream's structure, while still preserving them.
- def flattenPar[R1 <: R, E1 >: E, A1](n: Int, outputBuffer: Int = 16)(implicit ev: <:<[A, ZStream[R1, E1, A1]]): ZStream[R1, E1, A1]
Flattens a stream of streams into a stream by executing a non-deterministic concurrent merge.
Flattens a stream of streams into a stream by executing a non-deterministic concurrent merge. Up to
nstreams may be consumed in parallel and up tooutputBufferelements may be buffered by this operator. - def flattenParUnbounded[R1 <: R, E1 >: E, A1](outputBuffer: Int = 16)(implicit ev: <:<[A, ZStream[R1, E1, A1]]): ZStream[R1, E1, A1]
Like flattenPar, but executes all streams concurrently.
- final def flattenTake[E1 >: E, A1](implicit ev: <:<[A, Take[E1, A1]]): ZStream[R, E1, A1]
Unwraps Exit values and flatten chunks that also signify end-of-stream by failing with
None. - final def foreach[R1 <: R, E1 >: E](f: (A) => ZIO[R1, E1, Any]): ZIO[R1, E1, Unit]
Consumes all elements of the stream, passing them to the specified callback.
- def forever: ZStream[R, E, A]
Repeats this stream forever.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def groupBy[R1 <: R, E1 >: E, K, V](f: (A) => ZIO[R1, E1, (K, V)], buffer: Int = 16): GroupBy[R1, E1, K, V]
More powerful version of ZStream.groupByKey
- final def groupByKey[K](f: (A) => K, buffer: Int = 16): GroupBy[R, E, K, A]
Partition a stream using a function and process each stream individually.
Partition a stream using a function and process each stream individually. This returns a data structure that can be used to further filter down which groups shall be processed.
After calling apply on the GroupBy object, the remaining groups will be processed in parallel and the resulting streams merged in a nondeterministic fashion.
Up to
bufferelements may be buffered in any group stream before the producer is backpressured. Take care to consume from all streams in order to prevent deadlocks.Example: Collect the first 2 words for every starting letter from a stream of words.
ZStream.fromIterable(List("hello", "world", "hi", "holla")) .groupByKey(_.head) { case (k, s) => s.take(2).map((k, _)) } .runCollect .map(_ == List(('h', "hello"), ('h', "hi"), ('w', "world"))
- def grouped(chunkSize: Int): ZStream[R, E, Chunk[A]]
Partitions the stream with specified chunkSize
Partitions the stream with specified chunkSize
- chunkSize
size of the chunk
- def groupedWithin(chunkSize: Int, within: zio.Duration): ZStream[R with Has[Clock], E, Chunk[A]]
Partitions the stream with the specified chunkSize or until the specified duration has passed, whichever is satisfied first.
- final def haltAfter(duration: zio.Duration): ZStream[R with Has[Clock], E, A]
Specialized version of haltWhen which halts the evaluation of this stream after the given duration.
Specialized version of haltWhen which halts the evaluation of this stream after the given duration.
An element in the process of being pulled will not be interrupted when the given duration completes. See
interruptAfterfor this behavior. - final def haltWhen[E1 >: E](p: Promise[E1, _]): ZStream[R, E1, A]
Halts the evaluation of this stream when the provided promise resolves.
Halts the evaluation of this stream when the provided promise resolves.
If the promise completes with a failure, the stream will emit that failure.
- final def haltWhen[R1 <: R, E1 >: E](io: ZIO[R1, E1, Any]): ZStream[R1, E1, A]
Halts the evaluation of this stream when the provided IO completes.
Halts the evaluation of this stream when the provided IO completes. The given IO will be forked as part of the returned stream, and its success will be discarded.
An element in the process of being pulled will not be interrupted when the IO completes. See
interruptWhenfor this behavior.If the IO completes with a failure, the stream will emit that failure.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def interleave[R1 <: R, E1 >: E, A1 >: A](that: ZStream[R1, E1, A1]): ZStream[R1, E1, A1]
Interleaves this stream and the specified stream deterministically by alternating pulling values from this stream and the specified stream.
Interleaves this stream and the specified stream deterministically by alternating pulling values from this stream and the specified stream. When one stream is exhausted all remaining values in the other stream will be pulled.
- final def interleaveWith[R1 <: R, E1 >: E, A1 >: A](that: ZStream[R1, E1, A1])(b: ZStream[R1, E1, Boolean]): ZStream[R1, E1, A1]
Combines this stream and the specified stream deterministically using the stream of boolean values
bto control which stream to pull from next.Combines this stream and the specified stream deterministically using the stream of boolean values
bto control which stream to pull from next.trueindicates to pull from this stream andfalseindicates to pull from the specified stream. Only consumes as many elements as requested byb. If either this stream or the specified stream are exhausted further requests for values from that stream will be ignored. - final def interruptAfter(duration: zio.Duration): ZStream[R with Has[Clock], E, A]
Specialized version of interruptWhen which interrupts the evaluation of this stream after the given duration.
- final def interruptWhen[E1 >: E](p: Promise[E1, _]): ZStream[R, E1, A]
Interrupts the evaluation of this stream when the provided promise resolves.
Interrupts the evaluation of this stream when the provided promise resolves. This combinator will also interrupt any in-progress element being pulled from upstream.
If the promise completes with a failure, the stream will emit that failure.
- final def interruptWhen[R1 <: R, E1 >: E](io: ZIO[R1, E1, Any]): ZStream[R1, E1, A]
Interrupts the evaluation of this stream when the provided IO completes.
Interrupts the evaluation of this stream when the provided IO completes. The given IO will be forked as part of this stream, and its success will be discarded. This combinator will also interrupt any in-progress element being pulled from upstream.
If the IO completes with a failure before the stream completes, the returned stream will emit that failure.
- final def intersperse[A1 >: A](start: A1, middle: A1, end: A1): ZStream[R, E, A1]
Intersperse and also add a prefix and a suffix
- final def intersperse[A1 >: A](middle: A1): ZStream[R, E, A1]
Intersperse stream with provided element similar to
List.mkString. - final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def lock(executor: Executor): ZStream[R, E, A]
Locks the execution of this stream to the specified executor.
Locks the execution of this stream to the specified executor. Any streams that are composed after this one will automatically be shifted back to the previous executor.
- final def map[B](f: (A) => B): ZStream[R, E, B]
Transforms the elements of this stream using the supplied function.
- def mapAccum[S, A1](s: S)(f: (S, A) => (S, A1)): ZStream[R, E, A1]
Statefully maps over the elements of this stream to produce new elements.
- final def mapAccumZIO[R1 <: R, E1 >: E, S, A1](s: S)(f: (S, A) => ZIO[R1, E1, (S, A1)]): ZStream[R1, E1, A1]
Statefully and effectfully maps over the elements of this stream to produce new elements.
- def mapChunks[A2](f: (Chunk[A]) => Chunk[A2]): ZStream[R, E, A2]
Transforms the chunks emitted by this stream.
- def mapChunksZIO[R1 <: R, E1 >: E, A2](f: (Chunk[A]) => ZIO[R1, E1, Chunk[A2]]): ZStream[R1, E1, A2]
Effectfully transforms the chunks emitted by this stream.
- def mapConcat[A2](f: (A) => Iterable[A2]): ZStream[R, E, A2]
Maps each element to an iterable, and flattens the iterables into the output of this stream.
- def mapConcatChunk[A2](f: (A) => Chunk[A2]): ZStream[R, E, A2]
Maps each element to a chunk, and flattens the chunks into the output of this stream.
- final def mapConcatChunkZIO[R1 <: R, E1 >: E, A2](f: (A) => ZIO[R1, E1, Chunk[A2]]): ZStream[R1, E1, A2]
Effectfully maps each element to a chunk, and flattens the chunks into the output of this stream.
- final def mapConcatZIO[R1 <: R, E1 >: E, A2](f: (A) => ZIO[R1, E1, Iterable[A2]]): ZStream[R1, E1, A2]
Effectfully maps each element to an iterable, and flattens the iterables into the output of this stream.
- def mapError[E2](f: (E) => E2): ZStream[R, E2, A]
Transforms the errors emitted by this stream using
f. - def mapErrorCause[E2](f: (Cause[E]) => Cause[E2]): ZStream[R, E2, A]
Transforms the full causes of failures emitted by this stream.
- def mapZIO[R1 <: R, E1 >: E, A1](f: (A) => ZIO[R1, E1, A1]): ZStream[R1, E1, A1]
Maps over elements of the stream with the specified effectful function.
- final def mapZIOPar[R1 <: R, E1 >: E, A2](n: Int)(f: (A) => ZIO[R1, E1, A2]): ZStream[R1, E1, A2]
Maps over elements of the stream with the specified effectful function, executing up to
ninvocations offconcurrently.Maps over elements of the stream with the specified effectful function, executing up to
ninvocations offconcurrently. Transformed elements will be emitted in the original order.- Note
This combinator destroys the chunking structure. It's recommended to use chunkN afterwards.
- final def mapZIOParUnordered[R1 <: R, E1 >: E, A2](n: Int)(f: (A) => ZIO[R1, E1, A2]): ZStream[R1, E1, A2]
Maps over elements of the stream with the specified effectful function, executing up to
ninvocations offconcurrently.Maps over elements of the stream with the specified effectful function, executing up to
ninvocations offconcurrently. The element order is not enforced by this combinator, and elements may be reordered. - final def mapZIOPartitioned[R1 <: R, E1 >: E, A2, K](keyBy: (A) => K, buffer: Int = 16)(f: (A) => ZIO[R1, E1, A2]): ZStream[R1, E1, A2]
Maps over elements of the stream with the specified effectful function, partitioned by
pexecuting invocations offconcurrently.Maps over elements of the stream with the specified effectful function, partitioned by
pexecuting invocations offconcurrently. The number of concurrent invocations offis determined by the number of different outputs of typeK. Up tobufferelements may be buffered per partition. Transformed elements may be reordered but the order within a partition is maintained. - final def merge[R1 <: R, E1 >: E, A1 >: A](that: ZStream[R1, E1, A1], strategy: TerminationStrategy = TerminationStrategy.Both): ZStream[R1, E1, A1]
Merges this stream and the specified stream together.
Merges this stream and the specified stream together.
New produced stream will terminate when both specified stream terminate if no termination strategy is specified.
- final def mergeEither[R1 <: R, E1 >: E, A2](that: ZStream[R1, E1, A2]): ZStream[R1, E1, Either[A, A2]]
Merges this stream and the specified stream together to produce a stream of eithers.
- final def mergeTerminateEither[R1 <: R, E1 >: E, A1 >: A](that: ZStream[R1, E1, A1]): ZStream[R1, E1, A1]
Merges this stream and the specified stream together.
Merges this stream and the specified stream together. New produced stream will terminate when either stream terminates.
- final def mergeTerminateLeft[R1 <: R, E1 >: E, A1 >: A](that: ZStream[R1, E1, A1]): ZStream[R1, E1, A1]
Merges this stream and the specified stream together.
Merges this stream and the specified stream together. New produced stream will terminate when this stream terminates.
- final def mergeTerminateRight[R1 <: R, E1 >: E, A1 >: A](that: ZStream[R1, E1, A1]): ZStream[R1, E1, A1]
Merges this stream and the specified stream together.
Merges this stream and the specified stream together. New produced stream will terminate when the specified stream terminates.
- final def mergeWith[R1 <: R, E1 >: E, A2, A3](that: ZStream[R1, E1, A2], strategy: TerminationStrategy = TerminationStrategy.Both)(l: (A) => A3, r: (A2) => A3): ZStream[R1, E1, A3]
Merges this stream and the specified stream together to a common element type with the specified mapping functions.
Merges this stream and the specified stream together to a common element type with the specified mapping functions.
New produced stream will terminate when both specified stream terminate if no termination strategy is specified.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def onError[R1 <: R](cleanup: (Cause[E]) => URIO[R1, Any]): ZStream[R1, E, A]
Runs the specified effect if this stream fails, providing the error to the effect if it exists.
Runs the specified effect if this stream fails, providing the error to the effect if it exists.
Note: Unlike ZIO.onError, there is no guarantee that the provided effect will not be interrupted.
- def orElse[R1 <: R, E1, A1 >: A](that: => ZStream[R1, E1, A1])(implicit ev: CanFail[E]): ZStream[R1, E1, A1]
Switches to the provided stream in case this one fails with a typed error.
Switches to the provided stream in case this one fails with a typed error.
See also ZStream#catchAll.
- final def orElseEither[R1 <: R, E2, A2](that: => ZStream[R1, E2, A2])(implicit ev: CanFail[E]): ZStream[R1, E2, Either[A, A2]]
Switches to the provided stream in case this one fails with a typed error.
Switches to the provided stream in case this one fails with a typed error.
See also ZStream#catchAll.
- final def orElseFail[E1](e1: => E1)(implicit ev: CanFail[E]): ZStream[R, E1, A]
Fails with given error in case this one fails with a typed error.
Fails with given error in case this one fails with a typed error.
See also ZStream#catchAll.
- final def orElseOptional[R1 <: R, E1, A1 >: A](that: => ZStream[R1, Option[E1], A1])(implicit ev: <:<[E, Option[E1]]): ZStream[R1, Option[E1], A1]
Switches to the provided stream in case this one fails with the
Nonevalue.Switches to the provided stream in case this one fails with the
Nonevalue.See also ZStream#catchAll.
- final def orElseSucceed[A1 >: A](A1: => A1)(implicit ev: CanFail[E]): ZStream[R, Nothing, A1]
Succeeds with the specified value if this one fails with a typed error.
- def partition(p: (A) => Boolean, buffer: Int = 16): ZManaged[R, E, (ZStream[Any, E, A], ZStream[Any, E, A])]
Partition a stream using a predicate.
Partition a stream using a predicate. The first stream will contain all element evaluated to true and the second one will contain all element evaluated to false. The faster stream may advance by up to buffer elements further than the slower one.
- final def partitionEither[R1 <: R, E1 >: E, A2, A3](p: (A) => ZIO[R1, E1, Either[A2, A3]], buffer: Int = 16): ZManaged[R1, E1, (ZStream[Any, E1, A2], ZStream[Any, E1, A3])]
Split a stream by a predicate.
Split a stream by a predicate. The faster stream may advance by up to buffer elements further than the slower one.
- def peel[R1 <: R, E1 >: E, A1 >: A, Z](sink: ZSink[R1, E1, A1, E1, A1, Z]): ZManaged[R1, E1, (Z, ZStream[R1, E1, A1])]
Peels off enough material from the stream to construct a
Zusing the provided ZSink and then returns both theZand the rest of the ZStream in a managed resource. - final def provide(r: R)(implicit ev: NeedsEnv[R]): ZStream[Any, E, A]
Provides the stream with its required environment, which eliminates its dependency on
R. - def provideCustomLayer[E1 >: E, R1](layer: ZLayer[zio.ZEnv, E1, R1])(implicit ev1: <:<[zio.ZEnv with R1, R], ev2: Union[zio.ZEnv, R1], tagged: zio.Tag[R1]): ZStream[zio.ZEnv, E1, A]
Provides the part of the environment that is not part of the
ZEnv, leaving a stream that only depends on theZEnv.Provides the part of the environment that is not part of the
ZEnv, leaving a stream that only depends on theZEnv.val loggingLayer: ZLayer[Any, Nothing, Logging] = ??? val stream: ZStream[ZEnv with Logging, Nothing, Unit] = ??? val stream2 = stream.provideCustomLayer(loggingLayer)
- final def provideLayer[E1 >: E, R0, R1](layer: ZLayer[R0, E1, R1])(implicit ev: <:<[R1, R]): ZStream[R0, E1, A]
Provides a layer to the stream, which translates it to another level.
- final def provideSome[R0](env: (R0) => R)(implicit ev: NeedsEnv[R]): ZStream[R0, E, A]
Provides some of the environment required to run this effect, leaving the remainder
R0. - final def provideSomeLayer[R0]: ProvideSomeLayer[R0, R, E, A]
Splits the environment into two parts, providing one part using the specified layer and leaving the remainder
R0.Splits the environment into two parts, providing one part using the specified layer and leaving the remainder
R0.val clockLayer: ZLayer[Any, Nothing, Has[Clock]] = ??? val stream: ZStream[Has[Clock] with Has[Random], Nothing, Unit] = ??? val stream2 = stream.provideSomeLayer[Has[Random]](clockLayer)
- final def refineOrDie[E1](pf: PartialFunction[E, E1])(implicit ev1: <:<[E, Throwable], ev2: CanFail[E]): ZStream[R, E1, A]
Keeps some of the errors, and terminates the fiber with the rest
- final def refineOrDieWith[E1](pf: PartialFunction[E, E1])(f: (E) => Throwable)(implicit ev: CanFail[E]): ZStream[R, E1, A]
Keeps some of the errors, and terminates the fiber with the rest, using the specified function to convert the
Einto aThrowable. - final def repeat[R1 <: R, B](schedule: Schedule[R1, Any, B]): ZStream[R1 with Has[Clock], E, A]
Repeats the entire stream using the specified schedule.
Repeats the entire stream using the specified schedule. The stream will execute normally, and then repeat again according to the provided schedule.
- final def repeatEither[R1 <: R, B](schedule: Schedule[R1, Any, B]): ZStream[R1 with Has[Clock], E, Either[B, A]]
Repeats the entire stream using the specified schedule.
Repeats the entire stream using the specified schedule. The stream will execute normally, and then repeat again according to the provided schedule. The schedule output will be emitted at the end of each repetition.
- final def repeatElements[R1 <: R](schedule: Schedule[R1, A, Any]): ZStream[R1 with Has[Clock], E, A]
Repeats each element of the stream using the provided schedule.
Repeats each element of the stream using the provided schedule. Repetitions are done in addition to the first execution, which means using
Schedule.recurs(1)actually results in the original effect, plus an additional recurrence, for a total of two repetitions of each value in the stream. - final def repeatElementsEither[R1 <: R, E1 >: E, B](schedule: Schedule[R1, A, B]): ZStream[R1 with Has[Clock], E1, Either[B, A]]
Repeats each element of the stream using the provided schedule.
Repeats each element of the stream using the provided schedule. When the schedule is finished, then the output of the schedule will be emitted into the stream. Repetitions are done in addition to the first execution, which means using
Schedule.recurs(1)actually results in the original effect, plus an additional recurrence, for a total of two repetitions of each value in the stream. - final def repeatElementsWith[R1 <: R, E1 >: E, B, C](schedule: Schedule[R1, A, B])(f: (A) => C, g: (B) => C): ZStream[R1 with Has[Clock], E1, C]
Repeats each element of the stream using the provided schedule.
Repeats each element of the stream using the provided schedule. When the schedule is finished, then the output of the schedule will be emitted into the stream. Repetitions are done in addition to the first execution, which means using
Schedule.recurs(1)actually results in the original effect, plus an additional recurrence, for a total of two repetitions of each value in the stream.This function accepts two conversion functions, which allow the output of this stream and the output of the provided schedule to be unified into a single type. For example,
Eitheror similar data type. - final def repeatWith[R1 <: R, B, C](schedule: Schedule[R1, Any, B])(f: (A) => C, g: (B) => C): ZStream[R1 with Has[Clock], E, C]
Repeats the entire stream using the specified schedule.
Repeats the entire stream using the specified schedule. The stream will execute normally, and then repeat again according to the provided schedule. The schedule output will be emitted at the end of each repetition and can be unified with the stream elements using the provided functions.
- final def right[A1, A2](implicit ev: <:<[A, Either[A1, A2]]): ZStream[R, Option[E], A2]
Fails with the error
Noneif value isLeft. - final def rightOrFail[A1, A2, E1 >: E](e: => E1)(implicit ev: <:<[A, Either[A1, A2]]): ZStream[R, E1, A2]
Fails with given error 'e' if value is
Left. - def run[R1 <: R, E2, Z](sink: ZSink[R1, E, A, E2, Any, Z]): ZIO[R1, E2, Z]
Runs the sink on the stream to produce either the sink's result or an error.
- def runCollect: ZIO[R, E, Chunk[A]]
Runs the stream and collects all of its elements to a chunk.
- final def runCount: ZIO[R, E, Long]
Runs the stream and emits the number of elements processed
Runs the stream and emits the number of elements processed
Equivalent to
run(ZSink.count) - def runDrain: ZIO[R, E, Unit]
Runs the stream only for its effects.
Runs the stream only for its effects. The emitted elements are discarded.
- final def runFold[S](s: S)(f: (S, A) => S): ZIO[R, E, S]
Executes a pure fold over the stream of values - reduces all elements in the stream to a value of type
S. - final def runFoldManaged[S](s: S)(f: (S, A) => S): ZManaged[R, E, S]
Executes a pure fold over the stream of values.
Executes a pure fold over the stream of values. Returns a Managed value that represents the scope of the stream.
- final def runFoldManagedZIO[R1 <: R, E1 >: E, S](s: S)(f: (S, A) => ZIO[R1, E1, S]): ZManaged[R1, E1, S]
Executes an effectful fold over the stream of values.
Executes an effectful fold over the stream of values. Returns a Managed value that represents the scope of the stream.
- final def runFoldWhile[S](s: S)(cont: (S) => Boolean)(f: (S, A) => S): ZIO[R, E, S]
Reduces the elements in the stream to a value of type
S.Reduces the elements in the stream to a value of type
S. Stops the fold early when the condition is not fulfilled. Example:Stream(1).forever.foldWhile(0)(_ <= 4)(_ + _) // UIO[Int] == 5
- final def runFoldWhileM[R1 <: R, E1 >: E, S](s: S)(cont: (S) => Boolean)(f: (S, A) => ZIO[R1, E1, S]): ZIO[R1, E1, S]
Executes an effectful fold over the stream of values.
Executes an effectful fold over the stream of values. Stops the fold early when the condition is not fulfilled. Example:
Stream(1) .forever // an infinite Stream of 1's .fold(0)(_ <= 4)((s, a) => UIO(s + a)) // UIO[Int] == 5
- cont
function which defines the early termination condition
- def runFoldWhileManaged[S](s: S)(cont: (S) => Boolean)(f: (S, A) => S): ZManaged[R, E, S]
Executes a pure fold over the stream of values.
Executes a pure fold over the stream of values. Returns a Managed value that represents the scope of the stream. Stops the fold early when the condition is not fulfilled.
- final def runFoldWhileManagedZIO[R1 <: R, E1 >: E, S](s: S)(cont: (S) => Boolean)(f: (S, A) => ZIO[R1, E1, S]): ZManaged[R1, E1, S]
Executes an effectful fold over the stream of values.
Executes an effectful fold over the stream of values. Returns a Managed value that represents the scope of the stream. Stops the fold early when the condition is not fulfilled. Example:
Stream(1) .forever // an infinite Stream of 1's .fold(0)(_ <= 4)((s, a) => UIO(s + a)) // Managed[Nothing, Int] .use(ZIO.succeed) // UIO[Int] == 5
- cont
function which defines the early termination condition
- final def runFoldWhileZIO[R1 <: R, E1 >: E, S](s: S)(cont: (S) => Boolean)(f: (S, A) => ZIO[R1, E1, S]): ZIO[R1, E1, S]
Executes an effectful fold over the stream of values.
Executes an effectful fold over the stream of values. Stops the fold early when the condition is not fulfilled. Example:
Stream(1) .forever // an infinite Stream of 1's .fold(0)(_ <= 4)((s, a) => UIO(s + a)) // UIO[Int] == 5
- cont
function which defines the early termination condition
- final def runFoldZIO[R1 <: R, E1 >: E, S](s: S)(f: (S, A) => ZIO[R1, E1, S]): ZIO[R1, E1, S]
Executes an effectful fold over the stream of values.
- final def runForeach[R1 <: R, E1 >: E](f: (A) => ZIO[R1, E1, Any]): ZIO[R1, E1, Unit]
Consumes all elements of the stream, passing them to the specified callback.
- final def runForeachChunk[R1 <: R, E1 >: E](f: (Chunk[A]) => ZIO[R1, E1, Any]): ZIO[R1, E1, Unit]
Consumes all elements of the stream, passing them to the specified callback.
- final def runForeachChunkManaged[R1 <: R, E1 >: E](f: (Chunk[A]) => ZIO[R1, E1, Any]): ZManaged[R1, E1, Unit]
Like ZStream#foreachChunk, but returns a
ZManagedso the finalization order can be controlled. - final def runForeachManaged[R1 <: R, E1 >: E](f: (A) => ZIO[R1, E1, Any]): ZManaged[R1, E1, Unit]
Like ZStream#foreach, but returns a
ZManagedso the finalization order can be controlled. - final def runForeachWhile[R1 <: R, E1 >: E](f: (A) => ZIO[R1, E1, Boolean]): ZIO[R1, E1, Unit]
Consumes elements of the stream, passing them to the specified callback, and terminating consumption when the callback returns
false. - final def runForeachWhileManaged[R1 <: R, E1 >: E](f: (A) => ZIO[R1, E1, Boolean]): ZManaged[R1, E1, Unit]
Like ZStream#foreachWhile, but returns a
ZManagedso the finalization order can be controlled. - def runHead: ZIO[R, E, Option[A]]
Runs the stream to completion and yields the first value emitted by it, discarding the rest of the elements.
- final def runIntoHub[R1 <: R, E1 >: E](hub: ZHub[R1, Nothing, Nothing, Any, Take[E1, A], Any]): ZIO[R1, E1, Unit]
Publishes elements of this stream to a hub.
Publishes elements of this stream to a hub. Stream failure and ending will also be signalled.
- final def runIntoHubManaged[R1 <: R, E1 >: E](hub: ZHub[R1, Nothing, Nothing, Any, Take[E1, A], Any]): ZManaged[R1, E1, Unit]
Like ZStream#runIntoHub, but provides the result as a ZManaged to allow for scope composition.
- final def runIntoQueue[R1 <: R, E1 >: E](queue: ZQueue[R1, Nothing, Nothing, Any, Take[E1, A], Any]): ZIO[R1, E1, Unit]
Enqueues elements of this stream into a queue.
Enqueues elements of this stream into a queue. Stream failure and ending will also be signalled.
- final def runIntoQueueElementsManaged[R1 <: R, E1 >: E](queue: ZQueue[R1, Nothing, Nothing, Any, Exit[Option[E1], A], Any]): ZManaged[R1, E1, Unit]
Like ZStream#runIntoQueue, but provides the result as a ZManaged to allow for scope composition.
- final def runIntoQueueManaged[R1 <: R, E1 >: E](queue: ZQueue[R1, Nothing, Nothing, Any, Take[E1, A], Any]): ZManaged[R1, E1, Unit]
Like ZStream#runIntoQueue, but provides the result as a ZManaged to allow for scope composition.
- def runLast: ZIO[R, E, Option[A]]
Runs the stream to completion and yields the last value emitted by it, discarding the rest of the elements.
- def runManaged[R1 <: R, E2, B](sink: ZSink[R1, E, A, E2, Any, B]): ZManaged[R1, E2, B]
- final def runSum[A1 >: A](implicit ev: Numeric[A1]): ZIO[R, E, A1]
Runs the stream to a sink which sums elements, provided they are Numeric.
Runs the stream to a sink which sums elements, provided they are Numeric.
Equivalent to
run(Sink.sum[A]) - def scan[S](s: S)(f: (S, A) => S): ZStream[R, E, S]
Statefully maps over the elements of this stream to produce all intermediate results of type
Sgiven an initial S. - def scanReduce[A1 >: A](f: (A1, A) => A1): ZStream[R, E, A1]
Statefully maps over the elements of this stream to produce all intermediate results.
Statefully maps over the elements of this stream to produce all intermediate results.
See also ZStream#scan.
- def scanReduceZIO[R1 <: R, E1 >: E, A1 >: A](f: (A1, A) => ZIO[R1, E1, A1]): ZStream[R1, E1, A1]
Statefully and effectfully maps over the elements of this stream to produce all intermediate results.
Statefully and effectfully maps over the elements of this stream to produce all intermediate results.
See also ZStream#scanM.
- def scanZIO[R1 <: R, E1 >: E, S](s: S)(f: (S, A) => ZIO[R1, E1, S]): ZStream[R1, E1, S]
Statefully and effectfully maps over the elements of this stream to produce all intermediate results of type
Sgiven an initial S. - final def schedule[R1 <: R](schedule: Schedule[R1, A, Any]): ZStream[R1 with Has[Clock], E, A]
Schedules the output of the stream using the provided
schedule. - final def scheduleEither[R1 <: R, E1 >: E, B](schedule: Schedule[R1, A, B]): ZStream[R1 with Has[Clock], E1, Either[B, A]]
Schedules the output of the stream using the provided
scheduleand emits its output at the end (ifscheduleis finite). - final def scheduleWith[R1 <: R, E1 >: E, B, C](schedule: Schedule[R1, A, B])(f: (A) => C, g: (B) => C): ZStream[R1 with Has[Clock], E1, C]
Schedules the output of the stream using the provided
scheduleand emits its output at the end (ifscheduleis finite).Schedules the output of the stream using the provided
scheduleand emits its output at the end (ifscheduleis finite). Uses the provided function to align the stream and schedule outputs on the same type. - final def some[A2](implicit ev: <:<[A, Option[A2]]): ZStream[R, Option[E], A2]
Converts an option on values into an option on errors.
- final def someOrElse[A2](default: => A2)(implicit ev: <:<[A, Option[A2]]): ZStream[R, E, A2]
Extracts the optional value, or returns the given 'default'.
- final def someOrFail[A2, E1 >: E](e: => E1)(implicit ev: <:<[A, Option[A2]]): ZStream[R, E1, A2]
Extracts the optional value, or fails with the given error 'e'.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def take(n: Long): ZStream[R, E, A]
Takes the specified number of elements from this stream.
- def takeRight(n: Int): ZStream[R, E, A]
Takes the last specified number of elements from this stream.
- def takeUntil(f: (A) => Boolean): ZStream[R, E, A]
Takes all elements of the stream until the specified predicate evaluates to
true. - def takeUntilZIO[R1 <: R, E1 >: E](f: (A) => ZIO[R1, E1, Boolean]): ZStream[R1, E1, A]
Takes all elements of the stream until the specified effectual predicate evaluates to
true. - def takeWhile(f: (A) => Boolean): ZStream[R, E, A]
Takes all elements of the stream for as long as the specified predicate evaluates to
true. - final def tap[R1 <: R, E1 >: E](f0: (A) => ZIO[R1, E1, Any]): ZStream[R1, E1, A]
Adds an effect to consumption of every element of the stream.
- final def throttleEnforce(units: Long, duration: zio.Duration, burst: Long = 0)(costFn: (Chunk[A]) => Long): ZStream[R with Has[Clock], E, A]
Throttles the chunks of this stream according to the given bandwidth parameters using the token bucket algorithm.
Throttles the chunks of this stream according to the given bandwidth parameters using the token bucket algorithm. Allows for burst in the processing of elements by allowing the token bucket to accumulate tokens up to a
units + burstthreshold. Chunks that do not meet the bandwidth constraints are dropped. The weight of each chunk is determined by thecostFnfunction. - final def throttleEnforceZIO[R1 <: R, E1 >: E](units: Long, duration: zio.Duration, burst: Long = 0)(costFn: (Chunk[A]) => ZIO[R1, E1, Long]): ZStream[R1 with Has[Clock], E1, A]
Throttles the chunks of this stream according to the given bandwidth parameters using the token bucket algorithm.
Throttles the chunks of this stream according to the given bandwidth parameters using the token bucket algorithm. Allows for burst in the processing of elements by allowing the token bucket to accumulate tokens up to a
units + burstthreshold. Chunks that do not meet the bandwidth constraints are dropped. The weight of each chunk is determined by thecostFneffectful function. - final def throttleShape(units: Long, duration: zio.Duration, burst: Long = 0)(costFn: (Chunk[A]) => Long): ZStream[R with Has[Clock], E, A]
Delays the chunks of this stream according to the given bandwidth parameters using the token bucket algorithm.
Delays the chunks of this stream according to the given bandwidth parameters using the token bucket algorithm. Allows for burst in the processing of elements by allowing the token bucket to accumulate tokens up to a
units + burstthreshold. The weight of each chunk is determined by thecostFnfunction. - final def throttleShapeZIO[R1 <: R, E1 >: E](units: Long, duration: zio.Duration, burst: Long = 0)(costFn: (Chunk[A]) => ZIO[R1, E1, Long]): ZStream[R1 with Has[Clock], E1, A]
Delays the chunks of this stream according to the given bandwidth parameters using the token bucket algorithm.
Delays the chunks of this stream according to the given bandwidth parameters using the token bucket algorithm. Allows for burst in the processing of elements by allowing the token bucket to accumulate tokens up to a
units + burstthreshold. The weight of each chunk is determined by thecostFneffectful function. - final def timeout(d: zio.Duration): ZStream[R with Has[Clock], E, A]
Ends the stream if it does not produce a value after d duration.
- final def timeoutFail[E1 >: E](e: => E1)(d: zio.Duration): ZStream[R with Has[Clock], E1, A]
Fails the stream with given error if it does not produce a value after d duration.
- final def timeoutFailCause[E1 >: E](cause: Cause[E1])(d: zio.Duration): ZStream[R with Has[Clock], E1, A]
Fails the stream with given cause if it does not produce a value after d duration.
- final def timeoutTo[R1 <: R, E1 >: E, A2 >: A](d: zio.Duration)(that: ZStream[R1, E1, A2]): ZStream[R1 with Has[Clock], E1, A2]
Switches the stream if it does not produce a value after d duration.
- def toHub(capacity: Int): ZManaged[R, Nothing, ZHub[Nothing, Any, Any, Nothing, Nothing, Take[E, A]]]
Converts the stream to a managed hub of chunks.
Converts the stream to a managed hub of chunks. After the managed hub is used, the hub will never again produce values and should be discarded.
- def toInputStream(implicit ev0: <:<[E, Throwable], ev1: <:<[A, Byte]): ZManaged[R, E, InputStream]
Converts this stream of bytes into a
java.io.InputStreamwrapped in a ZManaged.Converts this stream of bytes into a
java.io.InputStreamwrapped in a ZManaged. The returned input stream will only be valid within the scope of the ZManaged. - def toIterator: ZManaged[R, Nothing, Iterator[Either[E, A]]]
Converts this stream into a
scala.collection.Iteratorwrapped in a ZManaged.Converts this stream into a
scala.collection.Iteratorwrapped in a ZManaged. The returned iterator will only be valid within the scope of the ZManaged. - def toPull: ZManaged[R, Nothing, ZIO[R, Option[E], Chunk[A]]]
- final def toQueue(capacity: Int = 2): ZManaged[R, Nothing, Dequeue[Take[E, A]]]
Converts the stream to a managed queue of chunks.
Converts the stream to a managed queue of chunks. After the managed queue is used, the queue will never again produce values and should be discarded.
- final def toQueueDropping(capacity: Int = 2): ZManaged[R, Nothing, Dequeue[Take[E, A]]]
Converts the stream to a dropping managed queue of chunks.
Converts the stream to a dropping managed queue of chunks. After the managed queue is used, the queue will never again produce values and should be discarded.
- final def toQueueOfElements(capacity: Int = 2): ZManaged[R, Nothing, Dequeue[Exit[Option[E], A]]]
Converts the stream to a managed queue of elements.
Converts the stream to a managed queue of elements. After the managed queue is used, the queue will never again produce values and should be discarded.
- final def toQueueSliding(capacity: Int = 2): ZManaged[R, Nothing, Dequeue[Take[E, A]]]
Converts the stream to a sliding managed queue of chunks.
Converts the stream to a sliding managed queue of chunks. After the managed queue is used, the queue will never again produce values and should be discarded.
- final def toQueueUnbounded: ZManaged[R, Nothing, Dequeue[Take[E, A]]]
Converts the stream into an unbounded managed queue.
Converts the stream into an unbounded managed queue. After the managed queue is used, the queue will never again produce values and should be discarded.
- def toReader(implicit ev0: <:<[E, Throwable], ev1: <:<[A, Char]): ZManaged[R, E, Reader]
Converts this stream of chars into a
java.io.Readerwrapped in a ZManaged.Converts this stream of chars into a
java.io.Readerwrapped in a ZManaged. The returned reader will only be valid within the scope of the ZManaged. - def toString(): String
- Definition Classes
- AnyRef → Any
- def transduce[R1 <: R, E1, A1 >: A, Z](sink: ZSink[R1, E, A1, E1, A1, Z]): ZStream[R1, E1, Z]
Applies the transducer to the stream and emits its outputs.
- final def updateService[M]: UpdateService[R, E, A, M]
Updates a service in the environment of this effect.
- final def via[R2, E2, A2](f: (ZStream[R, E, A]) => ZStream[R2, E2, A2]): ZStream[R2, E2, A2]
Threads the stream through the transformation function
f. - 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 withFilter(predicate: (A) => Boolean): ZStream[R, E, A]
Equivalent to filter but enables the use of filter clauses in for-comprehensions
- def zip[R1 <: R, E1 >: E, A2](that: ZStream[R1, E1, A2])(implicit zippable: Zippable[A, A2]): ZStream[R1, E1, Out]
Zips this stream with another point-wise and emits tuples of elements from both streams.
Zips this stream with another point-wise and emits tuples of elements from both streams.
The new stream will end when one of the sides ends.
- def zipAll[R1 <: R, E1 >: E, A1 >: A, A2](that: ZStream[R1, E1, A2])(defaultLeft: A1, defaultRight: A2): ZStream[R1, E1, (A1, A2)]
Zips this stream with another point-wise, creating a new stream of pairs of elements from both sides.
Zips this stream with another point-wise, creating a new stream of pairs of elements from both sides.
The defaults
defaultLeftanddefaultRightwill be used if the streams have different lengths and one of the streams has ended before the other. - def zipAllLeft[R1 <: R, E1 >: E, A1 >: A, A2](that: ZStream[R1, E1, A2])(default: A1): ZStream[R1, E1, A1]
Zips this stream with another point-wise, and keeps only elements from this stream.
Zips this stream with another point-wise, and keeps only elements from this stream.
The provided default value will be used if the other stream ends before this one.
- def zipAllRight[R1 <: R, E1 >: E, A2](that: ZStream[R1, E1, A2])(default: A2): ZStream[R1, E1, A2]
Zips this stream with another point-wise, and keeps only elements from the other stream.
Zips this stream with another point-wise, and keeps only elements from the other stream.
The provided default value will be used if this stream ends before the other one.
- def zipAllWith[R1 <: R, E1 >: E, A2, A3](that: ZStream[R1, E1, A2])(left: (A) => A3, right: (A2) => A3)(both: (A, A2) => A3): ZStream[R1, E1, A3]
Zips this stream with another point-wise.
Zips this stream with another point-wise. The provided functions will be used to create elements for the composed stream.
The functions
leftandrightwill be used if the streams have different lengths and one of the streams has ended before the other. - def zipAllWithExec[R1 <: R, E1 >: E, A2, A3](that: ZStream[R1, E1, A2])(exec: ExecutionStrategy)(left: (A) => A3, right: (A2) => A3)(both: (A, A2) => A3): ZStream[R1, E1, A3]
Zips this stream with another point-wise.
Zips this stream with another point-wise. The provided functions will be used to create elements for the composed stream.
The functions
leftandrightwill be used if the streams have different lengths and one of the streams has ended before the other.The execution strategy
execwill be used to determine whether to pull from the streams sequentially or in parallel. - def zipLeft[R1 <: R, E1 >: E, A2](that: ZStream[R1, E1, A2]): ZStream[R1, E1, A]
Zips this stream with another point-wise, but keeps only the outputs of this stream.
Zips this stream with another point-wise, but keeps only the outputs of this stream.
The new stream will end when one of the sides ends.
- def zipRight[R1 <: R, E1 >: E, A2](that: ZStream[R1, E1, A2]): ZStream[R1, E1, A2]
Zips this stream with another point-wise, but keeps only the outputs of the other stream.
Zips this stream with another point-wise, but keeps only the outputs of the other stream.
The new stream will end when one of the sides ends.
- def zipWith[R1 <: R, E1 >: E, A2, A3](that: ZStream[R1, E1, A2])(f: (A, A2) => A3): ZStream[R1, E1, A3]
Zips this stream with another point-wise and applies the function to the paired elements.
Zips this stream with another point-wise and applies the function to the paired elements.
The new stream will end when one of the sides ends.
- final def zipWithIndex: ZStream[R, E, (A, Long)]
Zips this stream together with the index of elements.
- final def zipWithLatest[R1 <: R, E1 >: E, A2, A3](that: ZStream[R1, E1, A2])(f: (A, A2) => A3): ZStream[R1, E1, A3]
Zips the two streams so that when a value is emitted by either of the two streams, it is combined with the latest value from the other stream to produce a result.
Zips the two streams so that when a value is emitted by either of the two streams, it is combined with the latest value from the other stream to produce a result.
Note: tracking the latest value is done on a per-chunk basis. That means that emitted elements that are not the last value in chunks will never be used for zipping.
- final def zipWithNext: ZStream[R, E, (A, Option[A])]
Zips each element with the next element if present.
- final def zipWithPrevious: ZStream[R, E, (Option[A], A)]
Zips each element with the previous element.
Zips each element with the previous element. Initially accompanied by
None. - final def zipWithPreviousAndNext: ZStream[R, E, (Option[A], A, Option[A])]
Zips each element with both the previous and next element.
Deprecated Value Members
- def >>=[R1 <: R, E1 >: E, A2](f0: (A) => ZStream[R1, E1, A2]): ZStream[R1, E1, A2]
Symbolic alias for ZStream#flatMap.
Symbolic alias for ZStream#flatMap.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use flatMap
- final def collectM[R1 <: R, E1 >: E, A1](pf: PartialFunction[A, ZIO[R1, E1, A1]]): ZStream[R1, E1, A1]
Performs an effectful filter and map in a single step.
Performs an effectful filter and map in a single step.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectZIO
- final def collectWhileM[R1 <: R, E1 >: E, A1](pf: PartialFunction[A, ZIO[R1, E1, A1]]): ZStream[R1, E1, A1]
Effectfully transforms all elements of the stream for as long as the specified partial function is defined.
Effectfully transforms all elements of the stream for as long as the specified partial function is defined.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectWhileZIO
- def filterM[R1 <: R, E1 >: E](f: (A) => ZIO[R1, E1, Boolean]): ZStream[R1, E1, A]
Effectfully filters the elements emitted by this stream.
Effectfully filters the elements emitted by this stream.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use filterZIO
- final def findM[R1 <: R, E1 >: E, S](f: (A) => ZIO[R1, E1, Boolean]): ZStream[R1, E1, A]
Finds the first element emitted by this stream that satisfies the provided effectful predicate.
Finds the first element emitted by this stream that satisfies the provided effectful predicate.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use findZIO
- final def mapAccumM[R1 <: R, E1 >: E, S, A1](s: S)(f: (S, A) => ZIO[R1, E1, (S, A1)]): ZStream[R1, E1, A1]
Statefully and effectfully maps over the elements of this stream to produce new elements.
Statefully and effectfully maps over the elements of this stream to produce new elements.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use mapAccumZIO
- def mapChunksM[R1 <: R, E1 >: E, A2](f: (Chunk[A]) => ZIO[R1, E1, Chunk[A2]]): ZStream[R1, E1, A2]
Effectfully transforms the chunks emitted by this stream.
Effectfully transforms the chunks emitted by this stream.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use mapChunksZIO
- final def mapConcatChunkM[R1 <: R, E1 >: E, A2](f: (A) => ZIO[R1, E1, Chunk[A2]]): ZStream[R1, E1, A2]
Effectfully maps each element to a chunk, and flattens the chunks into the output of this stream.
Effectfully maps each element to a chunk, and flattens the chunks into the output of this stream.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use mapConcatChunkZIO
- final def mapConcatM[R1 <: R, E1 >: E, A2](f: (A) => ZIO[R1, E1, Iterable[A2]]): ZStream[R1, E1, A2]
Effectfully maps each element to an iterable, and flattens the iterables into the output of this stream.
Effectfully maps each element to an iterable, and flattens the iterables into the output of this stream.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use mapConcatZIO
- def mapM[R1 <: R, E1 >: E, A1](f: (A) => ZIO[R1, E1, A1]): ZStream[R1, E1, A1]
Maps over elements of the stream with the specified effectful function.
Maps over elements of the stream with the specified effectful function.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use mapZIO
- final def mapMPar[R1 <: R, E1 >: E, A2](n: Int)(f: (A) => ZIO[R1, E1, A2]): ZStream[R1, E1, A2]
Maps over elements of the stream with the specified effectful function, executing up to
ninvocations offconcurrently.Maps over elements of the stream with the specified effectful function, executing up to
ninvocations offconcurrently. Transformed elements will be emitted in the original order.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use mapZIOPar
- Note
This combinator destroys the chunking structure. It's recommended to use chunkN afterwards.
- final def mapMParUnordered[R1 <: R, E1 >: E, A2](n: Int)(f: (A) => ZIO[R1, E1, A2]): ZStream[R1, E1, A2]
Maps over elements of the stream with the specified effectful function, executing up to
ninvocations offconcurrently.Maps over elements of the stream with the specified effectful function, executing up to
ninvocations offconcurrently. The element order is not enforced by this combinator, and elements may be reordered.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use mapZIOParUnordered
- final def mapMPartitioned[R1 <: R, E1 >: E, A2, K](keyBy: (A) => K, buffer: Int = 16)(f: (A) => ZIO[R1, E1, A2]): ZStream[R1, E1, A2]
Maps over elements of the stream with the specified effectful function, partitioned by
pexecuting invocations offconcurrently.Maps over elements of the stream with the specified effectful function, partitioned by
pexecuting invocations offconcurrently. The number of concurrent invocations offis determined by the number of different outputs of typeK. Up tobufferelements may be buffered per partition. Transformed elements may be reordered but the order within a partition is maintained.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use mapZIOPartitioned
- final def runFoldM[R1 <: R, E1 >: E, S](s: S)(f: (S, A) => ZIO[R1, E1, S]): ZIO[R1, E1, S]
Executes an effectful fold over the stream of values.
Executes an effectful fold over the stream of values.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use runFoldZIO
- final def runFoldManagedM[R1 <: R, E1 >: E, S](s: S)(f: (S, A) => ZIO[R1, E1, S]): ZManaged[R1, E1, S]
Executes an effectful fold over the stream of values.
Executes an effectful fold over the stream of values. Returns a Managed value that represents the scope of the stream.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use runFoldManagedZIO
- final def runFoldWhileManagedM[R1 <: R, E1 >: E, S](s: S)(cont: (S) => Boolean)(f: (S, A) => ZIO[R1, E1, S]): ZManaged[R1, E1, S]
Executes an effectful fold over the stream of values.
Executes an effectful fold over the stream of values. Returns a Managed value that represents the scope of the stream. Stops the fold early when the condition is not fulfilled. Example:
Stream(1) .forever // an infinite Stream of 1's .fold(0)(_ <= 4)((s, a) => UIO(s + a)) // Managed[Nothing, Int] .use(ZIO.succeed) // UIO[Int] == 5
- cont
function which defines the early termination condition
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use runFoldWhileManagedZIO
- final def runInto[R1 <: R, E1 >: E](queue: ZQueue[R1, Nothing, Nothing, Any, Take[E1, A], Any]): ZIO[R1, E1, Unit]
Enqueues elements of this stream into a queue.
Enqueues elements of this stream into a queue. Stream failure and ending will also be signalled.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use runIntoQueue
- final def runIntoElementsManaged[R1 <: R, E1 >: E](queue: ZQueue[R1, Nothing, Nothing, Any, Exit[Option[E1], A], Any]): ZManaged[R1, E1, Unit]
Like ZStream#runInto, but provides the result as a ZManaged to allow for scope composition.
Like ZStream#runInto, but provides the result as a ZManaged to allow for scope composition.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use runIntoQueueElementsManaged
- final def runIntoManaged[R1 <: R, E1 >: E](queue: ZQueue[R1, Nothing, Nothing, Any, Take[E1, A], Any]): ZManaged[R1, E1, Unit]
Like ZStream#runInto, but provides the result as a ZManaged to allow for scope composition.
Like ZStream#runInto, but provides the result as a ZManaged to allow for scope composition.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use runIntoQueueQueue
- def scanM[R1 <: R, E1 >: E, S](s: S)(f: (S, A) => ZIO[R1, E1, S]): ZStream[R1, E1, S]
Statefully and effectfully maps over the elements of this stream to produce all intermediate results of type
Sgiven an initial S.Statefully and effectfully maps over the elements of this stream to produce all intermediate results of type
Sgiven an initial S.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use scanZIO
- def scanReduceM[R1 <: R, E1 >: E, A1 >: A](f: (A1, A) => ZIO[R1, E1, A1]): ZStream[R1, E1, A1]
Statefully and effectfully maps over the elements of this stream to produce all intermediate results.
Statefully and effectfully maps over the elements of this stream to produce all intermediate results.
See also ZStream#scanM.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use scanReduceZIO
- def takeUntilM[R1 <: R, E1 >: E](f: (A) => ZIO[R1, E1, Boolean]): ZStream[R1, E1, A]
Takes all elements of the stream until the specified effectual predicate evaluates to
true.Takes all elements of the stream until the specified effectual predicate evaluates to
true.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use takeUntilZIO
- final def throttleEnforceM[R1 <: R, E1 >: E](units: Long, duration: zio.Duration, burst: Long = 0)(costFn: (Chunk[A]) => ZIO[R1, E1, Long]): ZStream[R1 with Has[Clock], E1, A]
Throttles the chunks of this stream according to the given bandwidth parameters using the token bucket algorithm.
Throttles the chunks of this stream according to the given bandwidth parameters using the token bucket algorithm. Allows for burst in the processing of elements by allowing the token bucket to accumulate tokens up to a
units + burstthreshold. Chunks that do not meet the bandwidth constraints are dropped. The weight of each chunk is determined by thecostFneffectful function.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use throttleEnforceZIO
- final def throttleShapeM[R1 <: R, E1 >: E](units: Long, duration: zio.Duration, burst: Long = 0)(costFn: (Chunk[A]) => ZIO[R1, E1, Long]): ZStream[R1 with Has[Clock], E1, A]
Delays the chunks of this stream according to the given bandwidth parameters using the token bucket algorithm.
Delays the chunks of this stream according to the given bandwidth parameters using the token bucket algorithm. Allows for burst in the processing of elements by allowing the token bucket to accumulate tokens up to a
units + burstthreshold. The weight of each chunk is determined by thecostFneffectful function.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use throttleShapeZIO
- final def timeoutHalt[E1 >: E](cause: Cause[E1])(d: zio.Duration): ZStream[R with Has[Clock], E1, A]
Halts the stream with given cause if it does not produce a value after d duration.
Halts the stream with given cause if it does not produce a value after d duration.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use timeoutFailCause