ZStream

zio.stream.ZStream
See theZStream companion object
final class ZStream[-R, +E, +A]

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
ZStream[R, E, A]

Members list

Concise view

Value members

Concrete methods

def !(implicit ev1: E <:< Throwable, ev2: CanFail[E], trace: Trace): ZStream[R, Nothing, A]

A symbolic alias for orDie.

A symbolic alias for orDie.

Attributes

def &>[R1 <: R, E1 >: E, A2](that: => ZStream[R1, E1, A2])(implicit trace: Trace): ZStream[R1, E1, A2]

Symbolic alias for ZStream#zipRight.

Symbolic alias for ZStream#zipRight.

Attributes

def *>[R1 <: R, E1 >: E, A2](that: => ZStream[R1, E1, A2])(implicit trace: Trace): ZStream[R1, E1, A2]

Symbolic alias for ZStream#crossRight.

Symbolic alias for ZStream#crossRight.

Attributes

def ++[R1 <: R, E1 >: E, A1 >: A](that: => ZStream[R1, E1, A1])(implicit trace: Trace): ZStream[R1, E1, A1]

Symbolic alias for ZStream#concat.

Symbolic alias for ZStream#concat.

Attributes

def <&[R1 <: R, E1 >: E, A2](that: => ZStream[R1, E1, A2])(implicit trace: Trace): ZStream[R1, E1, A]

Symbolic alias for ZStream#zipLeft.

Symbolic alias for ZStream#zipLeft.

Attributes

def <&>[R1 <: R, E1 >: E, A2](that: => ZStream[R1, E1, A2])(implicit zippable: Zippable[A, A2], trace: Trace): ZStream[R1, E1, Out]

Symbolic alias for ZStream#zip.

Symbolic alias for ZStream#zip.

Attributes

def <*[R1 <: R, E1 >: E, A2](that: => ZStream[R1, E1, A2])(implicit trace: Trace): ZStream[R1, E1, A]

Symbolic alias for ZStream#crossLeft.

Symbolic alias for ZStream#crossLeft.

Attributes

def <*>[R1 <: R, E1 >: E, A2](that: => ZStream[R1, E1, A2])(implicit zippable: Zippable[A, A2], trace: Trace): ZStream[R1, E1, Out]

Symbolic alias for ZStream#cross.

Symbolic alias for ZStream#cross.

Attributes

def <>[R1 <: R, E2, A1 >: A](that: => ZStream[R1, E2, A1])(implicit ev: CanFail[E], trace: Trace): ZStream[R1, E2, A1]

Symbolic alias for ZStream#orElse.

Symbolic alias for ZStream#orElse.

Attributes

def >>>[R1 <: R, E1 >: E, B](pipeline: => ZPipeline[R1, E1, A, B])(implicit trace: Trace): ZStream[R1, E1, B]

Symbolic alias for ZStream#via.

Symbolic alias for ZStream#via.

Attributes

def >>>[R1 <: R, E1 >: E, A2 >: A, Z](sink: => ZSink[R1, E1, A2, Any, Z])(implicit trace: Trace): ZIO[R1, E1, Z]

Symbolic alias for [zio.stream.ZStream!.run].

Symbolic alias for [zio.stream.ZStream!.run].

Attributes

def @@[LowerR <: UpperR, UpperR <: R, LowerE >: E, UpperE >: LowerE, LowerA >: A, UpperA >: LowerA](aspect: => ZStreamAspect[LowerR, UpperR, LowerE, UpperE, LowerA, UpperA])(implicit trace: Trace): ZStream[UpperR, LowerE, LowerA]

Returns a new ZStream that applies the specified aspect to this ZStream. Aspects are "transformers" that modify the behavior of their input in some well-defined way (for example, adding a timeout).

Returns a new ZStream that applies the specified aspect to this ZStream. Aspects are "transformers" that modify the behavior of their input in some well-defined way (for example, adding a timeout).

Attributes

def absolve[R1 <: R, E1, A1](implicit ev: ZStream[R, E, A] <:< ZStream[R1, E1, Either[E1, A1]], trace: Trace): ZStream[R1, E1, A1]

Returns a stream that submerges the error case of an Either into the ZStream.

Returns a stream that submerges the error case of an Either into the ZStream.

Attributes

def aggregateAsync[R1 <: R, E1 >: E, A1 >: A, B](sink: => ZSink[R1, E1, A1, A1, B])(implicit trace: Trace): ZStream[R1, E1, 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.foldWeightedZIO and ZSink.foldUntilZIO for sinks that cover the common usecases.

Attributes

def aggregateAsyncWithin[R1 <: R, E1 >: E, A1 >: A, B](sink: => ZSink[R1, E1, A1, A1, B], schedule: => Schedule[R1, Option[B], Any])(implicit trace: Trace): ZStream[R1, E1, B]

Like aggregateAsyncWithinEither, but only returns the Right results.

Like aggregateAsyncWithinEither, but only returns the Right results.

Attributes

schedule

signalling for when to stop the aggregation

sink

used for the aggregation

Returns:

ZStream[R1, E2, B]

def aggregateAsyncWithinEither[R1 <: R, E1 >: E, A1 >: A, B, C](sink: => ZSink[R1, E1, A1, A1, B], schedule: => Schedule[R1, Option[B], C])(implicit trace: Trace): ZStream[R1, E1, 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.

Attributes

schedule

signalling for when to stop the aggregation

sink

used for the aggregation

Returns:

ZStream[R1, E2, Either[C, B]]

def as[A2](A2: => A2)(implicit trace: Trace): ZStream[R, E, A2]

Maps the success values of this stream to the specified constant value.

Maps the success values of this stream to the specified constant value.

Attributes

def broadcast(n: => Int, maximumLag: => Int)(implicit trace: Trace): ZIO[R & Scope, Nothing, Chunk[ZStream[Any, E, A]]]

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 maximumLag chunks before the slowest downstream 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 maximumLag chunks before the slowest downstream stream.

Attributes

def broadcastDynamic(maximumLag: => Int)(implicit trace: Trace): ZIO[R & Scope, Nothing, ZStream[Any, E, A]]

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 maximumLag chunks before the slowest downstream 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 maximumLag chunks before the slowest downstream stream.

Attributes

def broadcastedQueues(n: => Int, maximumLag: => Int)(implicit trace: Trace): ZIO[R & Scope, Nothing, Chunk[Dequeue[Take[E, A]]]]

Converts the stream to a scoped list of queues. Every value will be replicated to every queue with the slowest queue being allowed to buffer maximumLag chunks before the driver is back pressured.

Converts the stream to a scoped list of queues. Every value will be replicated to every queue with the slowest queue being allowed to buffer maximumLag chunks before the driver is back pressured.

Queues can unsubscribe from upstream by shutting down.

Attributes

def broadcastedQueuesDynamic(maximumLag: => Int)(implicit trace: Trace): ZIO[R & Scope, Nothing, ZIO[Scope, Nothing, Dequeue[Take[E, A]]]]

Converts the stream to a scoped dynamic amount of queues. Every chunk will be replicated to every queue with the slowest queue being allowed to buffer maximumLag chunks before the driver is back pressured.

Converts the stream to a scoped dynamic amount of queues. Every chunk will be replicated to every queue with the slowest queue being allowed to buffer maximumLag chunks before the driver is back pressured.

Queues can unsubscribe from upstream by shutting down.

Attributes

def buffer(capacity: => Int)(implicit trace: Trace): ZStream[R, E, A]

Allows a faster producer to progress independently of a slower consumer by buffering up to capacity elements in a queue.

Allows a faster producer to progress independently of a slower consumer by buffering up to capacity elements in a queue.

Attributes

Note:

This combinator destroys the chunking structure. It's recommended to use rechunk afterwards.

Prefer capacities that are powers of 2 for better performance.

def bufferChunks(capacity: => Int)(implicit trace: Trace): ZStream[R, E, A]

Allows a faster producer to progress independently of a slower consumer by buffering up to capacity chunks in a queue.

Allows a faster producer to progress independently of a slower consumer by buffering up to capacity chunks in a queue.

Attributes

Note:

Prefer capacities that are powers of 2 for better performance.

def bufferChunksDropping(capacity: => Int)(implicit trace: Trace): ZStream[R, E, A]

Allows a faster producer to progress independently of a slower consumer by buffering up to capacity chunks in a dropping queue.

Allows a faster producer to progress independently of a slower consumer by buffering up to capacity chunks in a dropping queue.

Attributes

Note:

Prefer capacities that are powers of 2 for better performance.

def bufferChunksSliding(capacity: => Int)(implicit trace: Trace): ZStream[R, E, A]

Allows a faster producer to progress independently of a slower consumer by buffering up to capacity chunks in a sliding queue.

Allows a faster producer to progress independently of a slower consumer by buffering up to capacity chunks in a sliding queue.

Attributes

Note:

Prefer capacities that are powers of 2 for better performance.

def bufferDropping(capacity: => Int)(implicit trace: Trace): ZStream[R, E, A]

Allows a faster producer to progress independently of a slower consumer by buffering up to capacity elements in a dropping queue.

Allows a faster producer to progress independently of a slower consumer by buffering up to capacity elements in a dropping queue.

Attributes

Note:

This combinator destroys the chunking structure. It's recommended to use rechunk afterwards.

Prefer capacities that are powers of 2 for better performance.

def bufferSliding(capacity: => Int)(implicit trace: Trace): ZStream[R, E, A]

Allows a faster producer to progress independently of a slower consumer by buffering up to capacity elements in a sliding queue.

Allows a faster producer to progress independently of a slower consumer by buffering up to capacity elements in a sliding queue.

Attributes

Note:

This combinator destroys the chunking structure. It's recommended to use rechunk afterwards.

Prefer capacities that are powers of 2 for better performance.

def bufferUnbounded(implicit trace: Trace): ZStream[R, E, A]

Allows a faster producer to progress independently of a slower consumer by buffering chunks into an unbounded queue.

Allows a faster producer to progress independently of a slower consumer by buffering chunks into an unbounded queue.

Attributes

def catchAll[R1 <: R, E2, A1 >: A](f: E => ZStream[R1, E2, A1])(implicit ev: CanFail[E], trace: Trace): ZStream[R1, E2, A1]

Switches over to the stream produced by the provided function in case this one fails with a typed error.

Switches over to the stream produced by the provided function in case this one fails with a typed error.

Attributes

def catchAllCause[R1 <: R, E2, A1 >: A](f: Cause[E] => ZStream[R1, E2, A1])(implicit trace: Trace): ZStream[R1, E2, A1]

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.

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.

Attributes

def catchSome[R1 <: R, E1 >: E, A1 >: A](pf: PartialFunction[E, ZStream[R1, E1, A1]])(implicit trace: Trace): ZStream[R1, E1, A1]

Switches over to the stream produced by the provided function in case this one fails with some typed error.

Switches over to the stream produced by the provided function in case this one fails with some typed error.

Attributes

def catchSomeCause[R1 <: R, E1 >: E, A1 >: A](pf: PartialFunction[Cause[E], ZStream[R1, E1, A1]])(implicit trace: Trace): ZStream[R1, E1, A1]

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.

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.

Attributes

def changes(implicit trace: Trace): 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.

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.

Attributes

def changesWith(f: (A, A) => Boolean)(implicit trace: Trace): 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.

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.

Attributes

def changesWithZIO[R1 <: R, E1 >: E](f: (A, A) => ZIO[R1, E1, Boolean])(implicit trace: Trace): ZStream[R1, E1, A]

Returns a new stream that only emits elements that are not equal to the previous element emitted, using the specified effectual function to determine whether two elements are equal.

Returns a new stream that only emits elements that are not equal to the previous element emitted, using the specified effectual function to determine whether two elements are equal.

Attributes

def chunks(implicit trace: Trace): ZStream[R, E, Chunk[A]]

Exposes the underlying chunks of the stream as a stream of chunks of elements.

Exposes the underlying chunks of the stream as a stream of chunks of elements.

Attributes

def chunksWith[R1, E1, A1](f: ZStream[R, E, Chunk[A]] => ZStream[R1, E1, Chunk[A1]])(implicit trace: Trace): ZStream[R1, E1, A1]

Performs the specified stream transformation with the chunk structure of the stream exposed.

Performs the specified stream transformation with the chunk structure of the stream exposed.

Attributes

def collect[B](f: PartialFunction[A, B])(implicit trace: Trace): ZStream[R, E, B]

Performs a filter and map in a single step.

Performs a filter and map in a single step.

Attributes

def collectLeft[L1, A1](implicit ev: A <:< Either[L1, A1], trace: Trace): ZStream[R, E, L1]

Filters any Right values.

Filters any Right values.

Attributes

def collectRight[L1, A1](implicit ev: A <:< Either[L1, A1], trace: Trace): ZStream[R, E, A1]

Filters any Left values.

Filters any Left values.

Attributes

def collectSome[A1](implicit ev: A <:< Option[A1], trace: Trace): ZStream[R, E, A1]

Filters any 'None' values.

Filters any 'None' values.

Attributes

def collectSuccess[L1, A1](implicit ev: A <:< Exit[L1, A1], trace: Trace): ZStream[R, E, A1]

Filters any Exit.Failure values.

Filters any Exit.Failure values.

Attributes

def collectType[O1 <: O](implicit tag: ClassTag[O1], trace: Trace): ZStream[R, E, O1]
Implicitly added by SyntaxOps
def collectWhile[A1](pf: PartialFunction[A, A1])(implicit trace: Trace): ZStream[R, E, A1]

Transforms all elements of the stream for as long as the specified partial function is defined.

Transforms all elements of the stream for as long as the specified partial function is defined.

Attributes

def collectWhileLeft[L1, A1](implicit ev: A <:< Either[L1, A1], trace: Trace): ZStream[R, E, L1]

Terminates the stream when encountering the first Right.

Terminates the stream when encountering the first Right.

Attributes

def collectWhileRight[L1, A1](implicit ev: A <:< Either[L1, A1], trace: Trace): ZStream[R, E, A1]

Terminates the stream when encountering the first Left.

Terminates the stream when encountering the first Left.

Attributes

def collectWhileSome[A1](implicit ev: A <:< Option[A1], trace: Trace): ZStream[R, E, A1]

Terminates the stream when encountering the first None.

Terminates the stream when encountering the first None.

Attributes

def collectWhileSuccess[L1, A1](implicit ev: A <:< Exit[L1, A1], trace: Trace): ZStream[R, E, A1]

Terminates the stream when encountering the first Exit.Failure.

Terminates the stream when encountering the first Exit.Failure.

Attributes

def collectWhileZIO[R1 <: R, E1 >: E, A1](pf: PartialFunction[A, ZIO[R1, E1, A1]])(implicit trace: Trace): 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.

Attributes

def collectZIO[R1 <: R, E1 >: E, A1](pf: PartialFunction[A, ZIO[R1, E1, A1]])(implicit trace: Trace): ZStream[R1, E1, A1]

Performs an effectful filter and map in a single step.

Performs an effectful filter and map in a single step.

Attributes

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)]])(implicit trace: Trace): ZStream[R1, E1, A3]

Combines the elements from this stream and the specified stream by repeatedly applying the function f to extract an element using both sides and conceptually "offer" it to the destination stream. f can maintain some internal state to control the combining process, with the initial state being specified by s.

Combines the elements from this stream and the specified stream by repeatedly applying the function f to extract an element using both sides and conceptually "offer" it to the destination stream. f can maintain some internal state to control the combining process, with the initial state being specified by s.

Where possible, prefer ZStream#combineChunks for a more efficient implementation.

Attributes

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)]])(implicit trace: Trace): ZStream[R1, E1, A3]

Combines the chunks from this stream and the specified stream by repeatedly applying the function f to extract a chunk using both sides and conceptually "offer" it to the destination stream. f can maintain some internal state to control the combining process, with the initial state being specified by s.

Combines the chunks from this stream and the specified stream by repeatedly applying the function f to extract a chunk using both sides and conceptually "offer" it to the destination stream. f can maintain some internal state to control the combining process, with the initial state being specified by s.

Attributes

def concat[R1 <: R, E1 >: E, A1 >: A](that: => ZStream[R1, E1, A1])(implicit trace: Trace): 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.

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.

Attributes

def cross[R1 <: R, E1 >: E, B](that: => ZStream[R1, E1, B])(implicit zippable: Zippable[A, B], trace: Trace): ZStream[R1, E1, Out]

Composes this stream with the specified stream to create a cartesian product of elements. The that stream would be run multiple times, for every element in the this stream.

Composes this stream with the specified stream to create a cartesian product of elements. The that stream would be run multiple times, for every element in the this stream.

See also ZStream#zip and ZStream#&lt;&amp;&gt; for the more common point-wise variant.

Attributes

def crossLeft[R1 <: R, E1 >: E, B](that: => ZStream[R1, E1, B])(implicit trace: Trace): 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. The that stream would be run multiple times, for every element in the this stream.

Composes this stream with the specified stream to create a cartesian product of elements, but keeps only elements from this stream. The that stream would be run multiple times, for every element in the this stream.

See also ZStream#zip and ZStream#&lt;&amp;&gt; for the more common point-wise variant.

Attributes

def crossRight[R1 <: R, E1 >: E, B](that: => ZStream[R1, E1, B])(implicit trace: Trace): 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. The that stream would be run multiple times, for every element in the this stream.

Composes this stream with the specified stream to create a cartesian product of elements, but keeps only elements from the other stream. The that stream would be run multiple times, for every element in the this stream.

See also ZStream#zip and ZStream#&lt;&amp;&gt; for the more common point-wise variant.

Attributes

def crossWith[R1 <: R, E1 >: E, A2, C](that: => ZStream[R1, E1, A2])(f: (A, A2) => C)(implicit trace: Trace): ZStream[R1, E1, C]

Composes this stream with the specified stream to create a cartesian product of elements with a specified function. The that stream would be run multiple times, for every element in the this stream.

Composes this stream with the specified stream to create a cartesian product of elements with a specified function. The that stream would be run multiple times, for every element in the this stream.

See also ZStream#zip and ZStream#&lt;&amp;&gt; for the more common point-wise variant.

Attributes

def debounce(d: => Duration)(implicit trace: Trace): ZStream[R, E, A]

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.

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.

Attributes

Example:

A search engine may only want to initiate a search after a user has paused typing so as to not prematurely recommend results.

def debug(implicit trace: Trace): ZStream[R, E, A]

Taps the stream, printing the result of calling .toString on the emitted values.

Taps the stream, printing the result of calling .toString on the emitted values.

Attributes

def debug(label: String)(implicit trace: Trace): ZStream[R, E, A]

Taps the stream, printing the result of calling .toString on the emitted values. Prefixes the output with the given label.

Taps the stream, printing the result of calling .toString on the emitted values. Prefixes the output with the given label.

Attributes

def distributedWith[E1 >: E](n: => Int, maximumLag: => Int, decide: A => UIO[Int => Boolean])(implicit trace: Trace): ZIO[R & Scope, Nothing, List[Dequeue[Exit[Option[E1], A]]]]

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.

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.

Attributes

def distributedWithDynamic(maximumLag: => Int, decide: A => UIO[UniqueKey => Boolean], done: Exit[Option[E], Nothing] => UIO[Any])(implicit trace: Trace): ZIO[R & Scope, Nothing, UIO[(UniqueKey, Dequeue[Exit[Option[E], A]])]]

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.

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.

Attributes

def drain(implicit trace: Trace): ZStream[R, E, Nothing]

Converts this stream to a stream that executes its effects but emits no elements. Useful for sequencing effects using streams:

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.fromZIO(ZIO(println("Done!"))).drain ++
 Stream(4, 5, 6).tap(i => ZIO(println(i)))).run(Sink.drain)

Attributes

def drainFork[R1 <: R, E1 >: E](other: => ZStream[R1, E1, Any])(implicit trace: Trace): ZStream[R1, E1, A]

Drains the provided stream in the background for as long as this stream is running. If this stream ends before other, other will be interrupted. If other fails, this stream will fail with that error.

Drains the provided stream in the background for as long as this stream is running. If this stream ends before other, other will be interrupted. If other fails, this stream will fail with that error.

Attributes

def drop(n: => Int)(implicit trace: Trace): ZStream[R, E, A]

Drops the specified number of elements from this stream.

Drops the specified number of elements from this stream.

Attributes

def dropRight(n: => Int)(implicit trace: Trace): ZStream[R, E, A]

Drops the last specified number of elements from this stream.

Drops the last specified number of elements from this stream.

Attributes

Note:

This combinator keeps n elements in memory. Be careful with big numbers.

def dropUntil(pred: A => Boolean)(implicit trace: Trace): ZStream[R, E, A]

Drops all elements of the stream until the specified predicate evaluates to true.

Drops all elements of the stream until the specified predicate evaluates to true.

Attributes

def dropWhile(f: A => Boolean)(implicit trace: Trace): ZStream[R, E, A]

Drops all elements of the stream for as long as the specified predicate evaluates to true.

Drops all elements of the stream for as long as the specified predicate evaluates to true.

Attributes

def dropWhileZIO[R1 <: R, E1 >: E](f: A => ZIO[R1, E1, Boolean])(implicit trace: Trace): ZStream[R1, E1, A]

Drops all elements of the stream for as long as the specified predicate produces an effect that evalutates to true

Drops all elements of the stream for as long as the specified predicate produces an effect that evalutates to true

Attributes

See also:
def either(implicit ev: CanFail[E], trace: Trace): ZStream[R, Nothing, Either[E, A]]

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 the Either success case.

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 the Either success case.

Attributes

Note:

the stream will end as soon as the first error occurs.

def ensuring[R1 <: R](fin: => ZIO[R1, Nothing, Any])(implicit trace: Trace): ZStream[R1, E, A]

Executes the provided finalizer after this stream's finalizers run.

Executes the provided finalizer after this stream's finalizers run.

Attributes

def ensuringWith[R1 <: R](fin: Exit[E, Any] => ZIO[R1, Nothing, Any])(implicit trace: Trace): ZStream[R1, E, A]

Executes the provided finalizer after this stream's finalizers run.

Executes the provided finalizer after this stream's finalizers run.

Attributes

def filter(f: A => Boolean)(implicit trace: Trace): ZStream[R, E, A]

Filters the elements emitted by this stream using the provided function.

Filters the elements emitted by this stream using the provided function.

Attributes

def filterNot(pred: A => Boolean)(implicit trace: Trace): ZStream[R, E, A]

Filters this stream by the specified predicate, removing all elements for which the predicate evaluates to true.

Filters this stream by the specified predicate, removing all elements for which the predicate evaluates to true.

Attributes

def filterZIO[R1 <: R, E1 >: E](f: A => ZIO[R1, E1, Boolean])(implicit trace: Trace): ZStream[R1, E1, A]

Effectfully filters the elements emitted by this stream.

Effectfully filters the elements emitted by this stream.

Attributes

def find(f: A => Boolean)(implicit trace: Trace): ZStream[R, E, A]

Finds the first element emitted by this stream that satisfies the provided predicate.

Finds the first element emitted by this stream that satisfies the provided predicate.

Attributes

def findZIO[R1 <: R, E1 >: E, S](f: A => ZIO[R1, E1, Boolean])(implicit trace: Trace): 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.

Attributes

def flatMap[R1 <: R, E1 >: E, B](f: A => ZStream[R1, E1, B])(implicit trace: Trace): 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

Returns a stream made of the concatenation in strict order of all the streams produced by passing each element of this stream to f0

Attributes

def flatMapPar[R1 <: R, E1 >: E, B](n: => Int, bufferSize: => Int)(f: A => ZStream[R1, E1, B])(implicit trace: Trace): 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 n inner streams concurrently. Up to bufferSize elements of the produced streams may be buffered in memory by this operator.

Maps each element of this stream to another stream and returns the non-deterministic merge of those streams, executing up to n inner streams concurrently. Up to bufferSize elements of the produced streams may be buffered in memory by this operator.

Attributes

def flatMapParSwitch[R1 <: R, E1 >: E, B](n: => Int, bufferSize: => Int)(f: A => ZStream[R1, E1, B])(implicit trace: Trace): 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 n inner streams concurrently. When a new stream is created from an element of the source stream, the oldest executing stream is cancelled. Up to bufferSize elements of the produced streams may be buffered in memory by this operator.

Maps each element of this stream to another stream and returns the non-deterministic merge of those streams, executing up to n inner streams concurrently. When a new stream is created from an element of the source stream, the oldest executing stream is cancelled. Up to bufferSize elements of the produced streams may be buffered in memory by this operator.

Attributes

def flatten[R1 <: R, E1 >: E, A1](implicit ev: A <:< ZStream[R1, E1, A1], trace: Trace): ZStream[R1, E1, A1]

Flattens this stream-of-streams into a stream made of the concatenation in strict order of all the streams.

Flattens this stream-of-streams into a stream made of the concatenation in strict order of all the streams.

Attributes

def flattenChunks[A1](implicit ev: A <:< Chunk[A1], trace: Trace): ZStream[R, E, A1]

Submerges the chunks carried by this stream into the stream's structure, while still preserving them.

Submerges the chunks carried by this stream into the stream's structure, while still preserving them.

Attributes

def flattenExit[E1 >: E, A1](implicit ev: A <:< Exit[E1, A1], trace: Trace): ZStream[R, E1, A1]

Flattens Exit values. Exit.Failure values translate to stream failures while Exit.Success values translate to stream elements.

Flattens Exit values. Exit.Failure values translate to stream failures while Exit.Success values translate to stream elements.

Attributes

def flattenExitOption[E1 >: E, A1](implicit ev: A <:< Exit[Option[E1], A1], trace: Trace): 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(_))

Attributes

def flattenIterables[A1](implicit ev: A <:< Iterable[A1], trace: Trace): ZStream[R, E, A1]

Submerges the iterables carried by this stream into the stream's structure, while still preserving them.

Submerges the iterables carried by this stream into the stream's structure, while still preserving them.

Attributes

def flattenPar[R1 <: R, E1 >: E, A1](n: => Int, outputBuffer: => Int)(implicit ev: A <:< ZStream[R1, E1, A1], trace: Trace): ZStream[R1, E1, A1]

Flattens a stream of streams into a stream by executing a non-deterministic concurrent merge. Up to n streams may be consumed in parallel and up to outputBuffer elements may be buffered by this operator.

Flattens a stream of streams into a stream by executing a non-deterministic concurrent merge. Up to n streams may be consumed in parallel and up to outputBuffer elements may be buffered by this operator.

Attributes

def flattenParUnbounded[R1 <: R, E1 >: E, A1](outputBuffer: => Int)(implicit ev: A <:< ZStream[R1, E1, A1], trace: Trace): ZStream[R1, E1, A1]

Like flattenPar, but executes all streams concurrently.

Like flattenPar, but executes all streams concurrently.

Attributes

def flattenTake[E1 >: E, A1](implicit ev: A <:< Take[E1, A1], trace: Trace): ZStream[R, E1, A1]

Unwraps Exit values and flatten chunks that also signify end-of-stream by failing with None.

Unwraps Exit values and flatten chunks that also signify end-of-stream by failing with None.

Attributes

def flattenZIO[R1 <: R, E1 >: E, A1](implicit ev: A <:< ZIO[R1, E1, A1], trace: Trace): ZStream[R1, E1, A1]
def foreach[R1 <: R, E1 >: E](f: A => ZIO[R1, E1, Any])(implicit trace: Trace): ZIO[R1, E1, Unit]

Consumes all elements of the stream, passing them to the specified callback.

Consumes all elements of the stream, passing them to the specified callback.

Attributes

def forever(implicit trace: Trace): ZStream[R, E, A]

Repeats this stream forever.

Repeats this stream forever.

Attributes

def groupAdjacentBy[K](f: A => K)(implicit trace: Trace): ZStream[R, E, (K, NonEmptyChunk[A])]

Creates a pipeline that groups on adjacent keys, calculated by function f.

Creates a pipeline that groups on adjacent keys, calculated by function f.

Attributes

def groupBy[R1 <: R, E1 >: E, K, V](f: A => ZIO[R1, E1, (K, V)], buffer: => Int): GroupBy[R1, E1, K, V]

More powerful version of ZStream.groupByKey

More powerful version of ZStream.groupByKey

Attributes

def groupByKey[K](f: A => K, buffer: => Int): GroupBy[R, E, K, A]

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.

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 buffer elements 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"))

Attributes

def grouped(chunkSize: => Int)(implicit trace: Trace): ZStream[R, E, Chunk[A]]

Partitions the stream with specified chunkSize

Partitions the stream with specified chunkSize

Attributes

chunkSize

size of the chunk

def groupedWithin(chunkSize: => Int, within: => Duration)(implicit trace: Trace): ZStream[R, E, Chunk[A]]

Partitions the stream with the specified chunkSize or until the specified duration has passed, whichever is satisfied first.

Partitions the stream with the specified chunkSize or until the specified duration has passed, whichever is satisfied first.

Attributes

def haltAfter(duration: => Duration)(implicit trace: Trace): ZStream[R, 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 interruptAfter for this behavior.

Attributes

def haltWhen[R1 <: R, E1 >: E](io: ZIO[R1, E1, Any])(implicit trace: Trace): ZStream[R1, E1, A]

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.

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 interruptWhen for this behavior.

If the IO completes with a failure, the stream will emit that failure.

Attributes

def haltWhen[E1 >: E](p: Promise[E1, _])(implicit trace: Trace): 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.

Attributes

def interleave[R1 <: R, E1 >: E, A1 >: A](that: => ZStream[R1, E1, A1])(implicit trace: Trace): ZStream[R1, E1, A1]

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.

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.

Attributes

def interleaveWith[R1 <: R, E1 >: E, A1 >: A](that: => ZStream[R1, E1, A1])(b: => ZStream[R1, E1, Boolean])(implicit trace: Trace): ZStream[R1, E1, A1]

Combines this stream and the specified stream deterministically using the stream of boolean values b to control which stream to pull from next. true indicates to pull from this stream and false indicates to pull from the specified stream. Only consumes as many elements as requested by b. If either this stream or the specified stream are exhausted further requests for values from that stream will be ignored.

Combines this stream and the specified stream deterministically using the stream of boolean values b to control which stream to pull from next. true indicates to pull from this stream and false indicates to pull from the specified stream. Only consumes as many elements as requested by b. If either this stream or the specified stream are exhausted further requests for values from that stream will be ignored.

Attributes

def interruptAfter(duration: => Duration)(implicit trace: Trace): ZStream[R, E, A]

Specialized version of interruptWhen which interrupts the evaluation of this stream after the given duration.

Specialized version of interruptWhen which interrupts the evaluation of this stream after the given duration.

Attributes

def interruptWhen[R1 <: R, E1 >: E](io: ZIO[R1, E1, Any])(implicit trace: Trace): ZStream[R1, E1, A]

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.

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.

Attributes

def interruptWhen[E1 >: E](p: Promise[E1, _])(implicit trace: Trace): ZStream[R, E1, A]

Interrupts the evaluation of this stream when the provided promise resolves. This combinator will also interrupt any in-progress element being pulled from upstream.

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.

Attributes

def intersperse[A1 >: A](middle: => A1)(implicit trace: Trace): ZStream[R, E, A1]

Intersperse stream with provided element similar to List.mkString.

Intersperse stream with provided element similar to List.mkString.

Attributes

def intersperse[A1 >: A](start: => A1, middle: => A1, end: => A1)(implicit trace: Trace): ZStream[R, E, A1]

Intersperse and also add a prefix and a suffix

Intersperse and also add a prefix and a suffix

Attributes

def map[B](f: A => B)(implicit trace: Trace): ZStream[R, E, B]

Transforms the elements of this stream using the supplied function.

Transforms the elements of this stream using the supplied function.

Attributes

def mapAccum[S, A1](s: => S)(f: (S, A) => (S, A1))(implicit trace: Trace): ZStream[R, E, A1]

Statefully maps over the elements of this stream to produce new elements.

Statefully maps over the elements of this stream to produce new elements.

Attributes

def mapAccumZIO[R1 <: R, E1 >: E, S, A1](s: => S)(f: (S, A) => ZIO[R1, E1, (S, A1)])(implicit trace: Trace): 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.

Attributes

def mapBoth[E1, A1](f: E => E1, g: A => A1)(implicit ev: CanFail[E], trace: Trace): ZStream[R, E1, A1]

Returns a stream whose failure and success channels have been mapped by the specified pair of functions, f and g.

Returns a stream whose failure and success channels have been mapped by the specified pair of functions, f and g.

Attributes

def mapChunks[A2](f: Chunk[A] => Chunk[A2])(implicit trace: Trace): ZStream[R, E, A2]

Transforms the chunks emitted by this stream.

Transforms the chunks emitted by this stream.

Attributes

def mapChunksZIO[R1 <: R, E1 >: E, A2](f: Chunk[A] => ZIO[R1, E1, Chunk[A2]])(implicit trace: Trace): ZStream[R1, E1, A2]

Effectfully transforms the chunks emitted by this stream.

Effectfully transforms the chunks emitted by this stream.

Attributes

def mapConcat[A2](f: A => Iterable[A2])(implicit trace: Trace): ZStream[R, E, A2]

Maps each element to an iterable, and flattens the iterables into the output of this stream.

Maps each element to an iterable, and flattens the iterables into the output of this stream.

Attributes

def mapConcatChunk[A2](f: A => Chunk[A2])(implicit trace: Trace): ZStream[R, E, A2]

Maps each element to a chunk, and flattens the chunks into the output of this stream.

Maps each element to a chunk, and flattens the chunks into the output of this stream.

Attributes

def mapConcatChunkZIO[R1 <: R, E1 >: E, A2](f: A => ZIO[R1, E1, Chunk[A2]])(implicit trace: Trace): 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.

Attributes

def mapConcatZIO[R1 <: R, E1 >: E, A2](f: A => ZIO[R1, E1, Iterable[A2]])(implicit trace: Trace): 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.

Attributes

def mapError[E2](f: E => E2)(implicit trace: Trace): ZStream[R, E2, A]

Transforms the errors emitted by this stream using f.

Transforms the errors emitted by this stream using f.

Attributes

def mapErrorCause[E2](f: Cause[E] => Cause[E2])(implicit trace: Trace): ZStream[R, E2, A]

Transforms the full causes of failures emitted by this stream.

Transforms the full causes of failures emitted by this stream.

Attributes

def mapZIO[R1 <: R, E1 >: E, A1](f: A => ZIO[R1, E1, A1])(implicit trace: Trace): 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.

Attributes

def mapZIOPar[R1 <: R, E1 >: E, A2](n: => Int)(f: A => ZIO[R1, E1, A2])(implicit trace: Trace): ZStream[R1, E1, A2]

Maps over elements of the stream with the specified effectful function, executing up to n invocations of f concurrently. Transformed elements will be emitted in the original order.

Maps over elements of the stream with the specified effectful function, executing up to n invocations of f concurrently. Transformed elements will be emitted in the original order.

Attributes

Note:

This combinator destroys the chunking structure. It's recommended to use rechunk afterwards.

def mapZIOParByKey[R1 <: R, E1 >: E, A2, K](keyBy: A => K, buffer: => Int)(f: A => ZIO[R1, E1, A2])(implicit trace: Trace): ZStream[R1, E1, A2]

Maps over elements of the stream with the specified effectful function, partitioned by p executing invocations of f concurrently. The number of concurrent invocations of f is determined by the number of different outputs of type K. Up to buffer elements may be buffered per partition. Transformed elements may be reordered but the order within a partition is maintained.

Maps over elements of the stream with the specified effectful function, partitioned by p executing invocations of f concurrently. The number of concurrent invocations of f is determined by the number of different outputs of type K. Up to buffer elements may be buffered per partition. Transformed elements may be reordered but the order within a partition is maintained.

Attributes

def mapZIOParUnordered[R1 <: R, E1 >: E, A2](n: => Int)(f: A => ZIO[R1, E1, A2])(implicit trace: Trace): ZStream[R1, E1, A2]

Maps over elements of the stream with the specified effectful function, executing up to n invocations of f concurrently. The element order is not enforced by this combinator, and elements may be reordered.

Maps over elements of the stream with the specified effectful function, executing up to n invocations of f concurrently. The element order is not enforced by this combinator, and elements may be reordered.

Attributes

def merge[R1 <: R, E1 >: E, A1 >: A](that: => ZStream[R1, E1, A1], strategy: => HaltStrategy)(implicit trace: Trace): 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.

Attributes

def mergeEither[R1 <: R, E1 >: E, A2](that: => ZStream[R1, E1, A2])(implicit trace: Trace): ZStream[R1, E1, Either[A, A2]]

Merges this stream and the specified stream together to produce a stream of eithers.

Merges this stream and the specified stream together to produce a stream of eithers.

Attributes

def mergeHaltEither[R1 <: R, E1 >: E, A1 >: A](that: => ZStream[R1, E1, A1])(implicit trace: Trace): ZStream[R1, E1, A1]

Merges this stream and the specified stream together. New produced stream will terminate when either stream terminates.

Merges this stream and the specified stream together. New produced stream will terminate when either stream terminates.

Attributes

def mergeHaltLeft[R1 <: R, E1 >: E, A1 >: A](that: => ZStream[R1, E1, A1])(implicit trace: Trace): ZStream[R1, E1, A1]

Merges this stream and the specified stream together. New produced stream will terminate when this stream terminates.

Merges this stream and the specified stream together. New produced stream will terminate when this stream terminates.

Attributes

def mergeHaltRight[R1 <: R, E1 >: E, A1 >: A](that: => ZStream[R1, E1, A1])(implicit trace: Trace): ZStream[R1, E1, A1]

Merges this stream and the specified stream together. New produced stream will terminate when the specified stream terminates.

Merges this stream and the specified stream together. New produced stream will terminate when the specified stream terminates.

Attributes

def mergeLeft[R1 <: R, E1 >: E, A2](that: => ZStream[R1, E1, A2], strategy: HaltStrategy)(implicit trace: Trace): ZStream[R1, E1, A]

Merges this stream and the specified stream together, discarding the values from the right stream.

Merges this stream and the specified stream together, discarding the values from the right stream.

Attributes

def mergeRight[R1 <: R, E1 >: E, A2](that: => ZStream[R1, E1, A2], strategy: HaltStrategy)(implicit trace: Trace): ZStream[R1, E1, A2]

Merges this stream and the specified stream together, discarding the values from the left stream.

Merges this stream and the specified stream together, discarding the values from the left stream.

Attributes

def mergeWith[R1 <: R, E1 >: E, A2, A3](that: => ZStream[R1, E1, A2], strategy: => HaltStrategy)(l: A => A3, r: A2 => A3)(implicit trace: Trace): 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.

Attributes

def mkString(implicit trace: Trace): ZIO[R, E, String]

Returns a combined string resulting from concatenating each of the values from the stream

Returns a combined string resulting from concatenating each of the values from the stream

Attributes

def mkString(before: => String, middle: => String, after: => String)(implicit trace: Trace): ZIO[R, E, String]

Returns a combined string resulting from concatenating each of the values from the stream beginning with before interspersed with middle and ending with after.

Returns a combined string resulting from concatenating each of the values from the stream beginning with before interspersed with middle and ending with after.

Attributes

def onError[R1 <: R](cleanup: Cause[E] => URIO[R1, Any])(implicit trace: Trace): 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.

Attributes

def onExecutor(executor: => Executor)(implicit trace: Trace): ZStream[R, E, A]

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.

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.

Attributes

def orDie(implicit ev1: IsSubtypeOfError[E, Throwable], ev2: CanFail[E], trace: Trace): ZStream[R, Nothing, A]

Translates any failure into a stream termination, making the stream infallible and all failures unchecked.

Translates any failure into a stream termination, making the stream infallible and all failures unchecked.

Attributes

def orDieWith(f: E => Throwable)(implicit ev: CanFail[E], trace: Trace): ZStream[R, Nothing, A]

Keeps none of the errors, and terminates the stream with them, using the specified function to convert the E into a Throwable.

Keeps none of the errors, and terminates the stream with them, using the specified function to convert the E into a Throwable.

Attributes

def orElse[R1 <: R, E1, A1 >: A](that: => ZStream[R1, E1, A1])(implicit ev: CanFail[E], trace: Trace): 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.

Attributes

def orElseEither[R1 <: R, E2, A2](that: => ZStream[R1, E2, A2])(implicit ev: CanFail[E], trace: Trace): 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.

Attributes

def orElseFail[E1](e1: => E1)(implicit ev: CanFail[E], trace: Trace): 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.

Attributes

def orElseIfEmpty[A1 >: A](a: A1)(implicit trace: Trace): ZStream[R, E, A1]

Produces the specified element if this stream is empty.

Produces the specified element if this stream is empty.

Attributes

def orElseIfEmpty[A1 >: A](chunk: Chunk[A1])(implicit trace: Trace): ZStream[R, E, A1]

Produces the specified chunk if this stream is empty.

Produces the specified chunk if this stream is empty.

Attributes

def orElseIfEmpty[R1 <: R, E1 >: E, A1 >: A](stream: ZStream[R1, E1, A1])(implicit trace: Trace): ZStream[R1, E1, A1]

Switches to the provided stream in case this one is empty.

Switches to the provided stream in case this one is empty.

Attributes

def orElseOptional[R1 <: R, E1, A1 >: A](that: => ZStream[R1, Option[E1], A1])(implicit ev: E <:< Option[E1], trace: Trace): ZStream[R1, Option[E1], A1]

Switches to the provided stream in case this one fails with the None value.

Switches to the provided stream in case this one fails with the None value.

See also ZStream#catchAll.

Attributes

def orElseSucceed[A1 >: A](A1: => A1)(implicit ev: CanFail[E], trace: Trace): ZStream[R, Nothing, A1]

Succeeds with the specified value if this one fails with a typed error.

Succeeds with the specified value if this one fails with a typed error.

Attributes

def partition(p: A => Boolean, buffer: => Int)(implicit trace: Trace): ZIO[R & Scope, E, (ZStream[Any, E, A], ZStream[Any, E, A])]

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.

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.

Attributes

def partitionEither[R1 <: R, E1 >: E, A2, A3](p: A => ZIO[R1, E1, Either[A2, A3]], buffer: => Int)(implicit trace: Trace): ZIO[R1 & Scope, E1, (ZStream[Any, E1, A2], ZStream[Any, E1, A3])]

Split a stream by a predicate. The faster stream may advance by up to buffer elements further than the slower one.

Split a stream by a predicate. The faster stream may advance by up to buffer elements further than the slower one.

Attributes

def peel[R1 <: R, E1 >: E, A1 >: A, Z](sink: => ZSink[R1, E1, A1, A1, Z])(implicit trace: Trace): ZIO[R1 & Scope, E1, (Z, ZStream[Any, E, A1])]

Peels off enough material from the stream to construct a Z using the provided ZSink and then returns both the Z and the rest of the ZStream in a scope. Like all scoped values, the provided stream is valid only within the scope.

Peels off enough material from the stream to construct a Z using the provided ZSink and then returns both the Z and the rest of the ZStream in a scope. Like all scoped values, the provided stream is valid only within the scope.

Attributes

def pipeThrough[R1 <: R, E1 >: E, L, Z](sink: => ZSink[R1, E1, A, L, Z])(implicit trace: Trace): ZStream[R1, E1, L]

Pipes all of the values from this stream through the provided sink.

Pipes all of the values from this stream through the provided sink.

Attributes

See also:
def pipeThroughChannel[R1 <: R, E2, A2](channel: => ZChannel[R1, E, Chunk[A], Any, E2, Chunk[A2], Any])(implicit trace: Trace): ZStream[R1, E2, A2]

Pipes all the values from this stream through the provided channel

Pipes all the values from this stream through the provided channel

Attributes

def pipeThroughChannelOrFail[R1 <: R, E1 >: E, A2](channel: ZChannel[R1, Nothing, Chunk[A], Any, E1, Chunk[A2], Any])(implicit trace: Trace): ZStream[R1, E1, A2]

Pipes all values from this stream through the provided channel, passing through any error emitted by this stream unchanged.

Pipes all values from this stream through the provided channel, passing through any error emitted by this stream unchanged.

Attributes

def provideEnvironment(r: => ZEnvironment[R])(implicit trace: Trace): ZStream[Any, E, A]

Provides the stream with its required environment, which eliminates its dependency on R.

Provides the stream with its required environment, which eliminates its dependency on R.

Attributes

def provideLayer[E1 >: E, R0](layer: => ZLayer[R0, E1, R])(implicit trace: Trace): ZStream[R0, E1, A]

Provides a layer to the stream, which translates it to another level.

Provides a layer to the stream, which translates it to another level.

Attributes

def provideSomeEnvironment[R0](env: ZEnvironment[R0] => ZEnvironment[R])(implicit trace: Trace): ZStream[R0, E, A]

Transforms the environment being provided to the stream with the specified function.

Transforms the environment being provided to the stream with the specified function.

Attributes

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 loggingLayer: ZLayer[Any, Nothing, Logging] = ???

val stream: ZStream[Logging with Database, Nothing, Unit] = ???

val stream2 = stream.provideSomeLayer[Database](loggingLayer)

Attributes

def rechunk(n: => Int)(implicit trace: Trace): ZStream[R, E, A]

Re-chunks the elements of the stream into chunks of n elements each. The last chunk might contain less than n elements

Re-chunks the elements of the stream into chunks of n elements each. The last chunk might contain less than n elements

Attributes

def refineOrDie[E1](pf: PartialFunction[E, E1])(implicit ev1: E <:< Throwable, ev2: CanFail[E], trace: Trace): ZStream[R, E1, A]

Keeps some of the errors, and terminates the fiber with the rest

Keeps some of the errors, and terminates the fiber with the rest

Attributes

def refineOrDieWith[E1](pf: PartialFunction[E, E1])(f: E => Throwable)(implicit ev: CanFail[E], trace: Trace): ZStream[R, E1, A]

Keeps some of the errors, and terminates the fiber with the rest, using the specified function to convert the E into a Throwable.

Keeps some of the errors, and terminates the fiber with the rest, using the specified function to convert the E into a Throwable.

Attributes

def refineToOrDie[E1 <: E : ClassTag](implicit evidence$2: ClassTag[E1], ev: CanFail[E], trace: Trace): ZStream[R, E1, A]
Implicitly added by RefineToOrDieOps

Keeps some of the errors, and terminates the fiber with the rest.

Keeps some of the errors, and terminates the fiber with the rest.

Attributes

def repeat[R1 <: R, B](schedule: => Schedule[R1, Any, B])(implicit trace: Trace): ZStream[R1, E, A]

Repeats the entire stream using the specified schedule. The stream will execute normally, and then repeat again according to the provided schedule.

Repeats the entire stream using the specified schedule. The stream will execute normally, and then repeat again according to the provided schedule.

Attributes

def repeatEither[R1 <: R, B](schedule: => Schedule[R1, Any, B])(implicit trace: Trace): ZStream[R1, E, Either[B, A]]

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.

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.

Attributes

def repeatElements[R1 <: R](schedule: => Schedule[R1, A, Any])(implicit trace: Trace): ZStream[R1, E, A]

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.

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.

Attributes

def repeatElementsEither[R1 <: R, E1 >: E, B](schedule: => Schedule[R1, A, B])(implicit trace: Trace): ZStream[R1, E1, Either[B, A]]

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.

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.

Attributes

def repeatElementsWith[R1 <: R, E1 >: E, B, C](schedule: => Schedule[R1, A, B])(f: A => C, g: B => C)(implicit trace: Trace): ZStream[R1, E1, C]

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.

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, Either or similar data type.

Attributes

def repeatWith[R1 <: R, B, C](schedule: => Schedule[R1, Any, B])(f: A => C, g: B => C)(implicit trace: Trace): ZStream[R1, E, C]

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.

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.

Attributes

def retry[R1 <: R](schedule: => Schedule[R1, E, _])(implicit trace: Trace): ZStream[R1, E, A]

When the stream fails, retry it according to the given schedule

When the stream fails, retry it according to the given schedule

This retries the entire stream, so will re-execute all of the stream's acquire operations.

The schedule is reset as soon as the first element passes through the stream again.

Attributes

schedule

Schedule receiving as input the errors of the stream

Returns:

Stream outputting elements of all attempts of the stream

def right[A1, A2](implicit ev: A <:< Either[A1, A2], trace: Trace): ZStream[R, Option[E], A2]

Fails with the error None if value is Left.

Fails with the error None if value is Left.

Attributes

def rightOrFail[A1, A2, E1 >: E](e: => E1)(implicit ev: A <:< Either[A1, A2], trace: Trace): ZStream[R, E1, A2]

Fails with given error 'e' if value is Left.

Fails with given error 'e' if value is Left.

Attributes

def run[R1 <: R, E1 >: E, Z](sink: => ZSink[R1, E1, A, Any, Z])(implicit trace: Trace): ZIO[R1, E1, Z]

Runs the sink on the stream to produce either the sink's result or an error.

Runs the sink on the stream to produce either the sink's result or an error.

Attributes

def runCollect(implicit trace: Trace): ZIO[R, E, Chunk[A]]

Runs the stream and collects all of its elements to a chunk.

Runs the stream and collects all of its elements to a chunk.

Attributes

def runCount(implicit trace: Trace): 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)

Attributes

def runDrain(implicit trace: Trace): ZIO[R, E, Unit]

Runs the stream only for its effects. The emitted elements are discarded.

Runs the stream only for its effects. The emitted elements are discarded.

Attributes

def runFold[S](s: => S)(f: (S, A) => S)(implicit trace: Trace): 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.

Executes a pure fold over the stream of values - reduces all elements in the stream to a value of type S.

Attributes

def runFoldScoped[S](s: => S)(f: (S, A) => S)(implicit trace: Trace): ZIO[R & Scope, E, S]

Executes a pure fold over the stream of values. Returns a scoped value that represents the scope of the stream.

Executes a pure fold over the stream of values. Returns a scoped value that represents the scope of the stream.

Attributes

def runFoldScopedZIO[R1 <: R, E1 >: E, S](s: => S)(f: (S, A) => ZIO[R1, E1, S])(implicit trace: Trace): ZIO[R1 & Scope, E1, S]

Executes an effectful fold over the stream of values. Returns a scoped value that represents the scope of the stream.

Executes an effectful fold over the stream of values. Returns a scoped value that represents the scope of the stream.

Attributes

def runFoldWhile[S](s: => S)(cont: S => Boolean)(f: (S, A) => S)(implicit trace: Trace): ZIO[R, E, S]

Reduces the elements in the stream to a value of type S. Stops the fold early when the condition is not fulfilled. Example:

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

Attributes

def runFoldWhileScoped[S](s: => S)(cont: S => Boolean)(f: (S, A) => S)(implicit trace: Trace): ZIO[R & Scope, E, S]

Executes a pure fold over the stream of values. Returns a scoped value that represents the scope of the stream. Stops the fold early when the condition is not fulfilled.

Executes a pure fold over the stream of values. Returns a scoped value that represents the scope of the stream. Stops the fold early when the condition is not fulfilled.

Attributes

def runFoldWhileScopedZIO[R1 <: R, E1 >: E, S](s: => S)(cont: S => Boolean)(f: (S, A) => ZIO[R1, E1, S])(implicit trace: Trace): ZIO[R1 & Scope, E1, S]

Executes an effectful fold over the stream of values. Returns a scoped value that represents the scope of the stream. Stops the fold early when the condition is not fulfilled. Example:

Executes an effectful fold over the stream of values. Returns a scoped 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) => ZIO.succeed(s + a))  // URIO[Scope, Int] == 5

Attributes

cont

function which defines the early termination condition

def runFoldWhileZIO[R1 <: R, E1 >: E, S](s: => S)(cont: S => Boolean)(f: (S, A) => ZIO[R1, E1, S])(implicit trace: Trace): ZIO[R1, E1, S]

Executes an effectful fold over the stream of values. Stops the fold early when the condition is not fulfilled. Example:

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) => ZIO.succeed(s + a))  // UIO[Int] == 5

Attributes

cont

function which defines the early termination condition

def runFoldZIO[R1 <: R, E1 >: E, S](s: => S)(f: (S, A) => ZIO[R1, E1, S])(implicit trace: Trace): ZIO[R1, E1, S]

Executes an effectful fold over the stream of values.

Executes an effectful fold over the stream of values.

Attributes

def runForeach[R1 <: R, E1 >: E](f: A => ZIO[R1, E1, Any])(implicit trace: Trace): ZIO[R1, E1, Unit]

Consumes all elements of the stream, passing them to the specified callback.

Consumes all elements of the stream, passing them to the specified callback.

Attributes

def runForeachChunk[R1 <: R, E1 >: E](f: Chunk[A] => ZIO[R1, E1, Any])(implicit trace: Trace): ZIO[R1, E1, Unit]

Consumes all elements of the stream, passing them to the specified callback.

Consumes all elements of the stream, passing them to the specified callback.

Attributes

def runForeachChunkScoped[R1 <: R, E1 >: E](f: Chunk[A] => ZIO[R1, E1, Any])(implicit trace: Trace): ZIO[R1 & Scope, E1, Unit]

Like ZStream#runForeachChunk, but returns a scoped ZIO so the finalization order can be controlled.

Like ZStream#runForeachChunk, but returns a scoped ZIO so the finalization order can be controlled.

Attributes

def runForeachScoped[R1 <: R, E1 >: E](f: A => ZIO[R1, E1, Any])(implicit trace: Trace): ZIO[R1 & Scope, E1, Unit]

Like ZStream#foreach, but returns a scoped ZIO so the finalization order can be controlled.

Like ZStream#foreach, but returns a scoped ZIO so the finalization order can be controlled.

Attributes

def runForeachWhile[R1 <: R, E1 >: E](f: A => ZIO[R1, E1, Boolean])(implicit trace: Trace): ZIO[R1, E1, Unit]

Consumes elements of the stream, passing them to the specified callback, and terminating consumption when the callback returns false.

Consumes elements of the stream, passing them to the specified callback, and terminating consumption when the callback returns false.

Attributes

def runForeachWhileScoped[R1 <: R, E1 >: E](f: A => ZIO[R1, E1, Boolean])(implicit trace: Trace): ZIO[R1 & Scope, E1, Unit]

Like ZStream#runForeachWhile, but returns a scoped ZIO so the finalization order can be controlled.

Like ZStream#runForeachWhile, but returns a scoped ZIO so the finalization order can be controlled.

Attributes

def runHead(implicit trace: Trace): ZIO[R, E, Option[A]]

Runs the stream to completion and yields the first value emitted by it, discarding the rest of the elements.

Runs the stream to completion and yields the first value emitted by it, discarding the rest of the elements.

Attributes

def runIntoHub[E1 >: E, A1 >: A](hub: => Hub[Take[E1, A1]])(implicit trace: Trace): ZIO[R, Nothing, Unit]

Publishes elements of this stream to a hub. Stream failure and ending will also be signalled.

Publishes elements of this stream to a hub. Stream failure and ending will also be signalled.

Attributes

def runIntoHubScoped[E1 >: E, A1 >: A](hub: => Hub[Take[E1, A1]])(implicit trace: Trace): ZIO[R & Scope, Nothing, Unit]

Like ZStream#runIntoHub, but provides the result as a scoped ZIO to allow for scope composition.

Like ZStream#runIntoHub, but provides the result as a scoped ZIO to allow for scope composition.

Attributes

def runIntoQueue(queue: => Enqueue[Take[E, A]])(implicit trace: Trace): ZIO[R, Nothing, Unit]

Enqueues elements of this stream into a queue. Stream failure and ending will also be signalled.

Enqueues elements of this stream into a queue. Stream failure and ending will also be signalled.

Attributes

def runIntoQueueElementsScoped(queue: => Enqueue[Exit[Option[E], A]])(implicit trace: Trace): ZIO[R & Scope, Nothing, Unit]

Like ZStream#runIntoQueue, but provides the result as a scoped ZIO to allow for scope composition.

Like ZStream#runIntoQueue, but provides the result as a scoped ZIO to allow for scope composition.

Attributes

def runIntoQueueScoped(queue: => Enqueue[Take[E, A]])(implicit trace: Trace): ZIO[R & Scope, Nothing, Unit]

Like ZStream#runIntoQueue, but provides the result as a scoped [[ZIO] to allow for scope composition.

Like ZStream#runIntoQueue, but provides the result as a scoped [[ZIO] to allow for scope composition.

Attributes

def runLast(implicit trace: Trace): ZIO[R, E, Option[A]]

Runs the stream to completion and yields the last value emitted by it, discarding the rest of the elements.

Runs the stream to completion and yields the last value emitted by it, discarding the rest of the elements.

Attributes

def runScoped[R1 <: R, E1 >: E, B](sink: => ZSink[R1, E1, A, Any, B])(implicit trace: Trace): ZIO[R1 & Scope, E1, B]
def runSum[A1 >: A](implicit ev: Numeric[A1], trace: Trace): 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])

Attributes

def scan[S](s: => S)(f: (S, A) => S)(implicit trace: Trace): ZStream[R, E, S]

Statefully maps over the elements of this stream to produce all intermediate results of type S given an initial S.

Statefully maps over the elements of this stream to produce all intermediate results of type S given an initial S.

Attributes

def scanReduce[A1 >: A](f: (A1, A) => A1)(implicit trace: Trace): 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.

Attributes

def scanReduceZIO[R1 <: R, E1 >: E, A1 >: A](f: (A1, A) => ZIO[R1, E1, A1])(implicit trace: Trace): 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#scanZIO.

Attributes

def scanZIO[R1 <: R, E1 >: E, S](s: => S)(f: (S, A) => ZIO[R1, E1, S])(implicit trace: Trace): ZStream[R1, E1, S]

Statefully and effectfully maps over the elements of this stream to produce all intermediate results of type S given an initial S.

Statefully and effectfully maps over the elements of this stream to produce all intermediate results of type S given an initial S.

Attributes

def schedule[R1 <: R](schedule: => Schedule[R1, A, Any])(implicit trace: Trace): ZStream[R1, E, A]

Schedules the output of the stream using the provided schedule.

Schedules the output of the stream using the provided schedule.

Attributes

def scheduleEither[R1 <: R, E1 >: E, B](schedule: => Schedule[R1, A, B])(implicit trace: Trace): ZStream[R1, E1, Either[B, A]]

Schedules the output of the stream using the provided schedule and emits its output at the end (if schedule is finite).

Schedules the output of the stream using the provided schedule and emits its output at the end (if schedule is finite).

Attributes

def scheduleWith[R1 <: R, E1 >: E, B, C](schedule: => Schedule[R1, A, B])(f: A => C, g: B => C)(implicit trace: Trace): ZStream[R1, E1, C]

Schedules the output of the stream using the provided schedule and emits its output at the end (if schedule is finite). Uses the provided function to align the stream and schedule outputs on the same type.

Schedules the output of the stream using the provided schedule and emits its output at the end (if schedule is finite). Uses the provided function to align the stream and schedule outputs on the same type.

Attributes

def sliding(chunkSize: => Int, stepSize: Int)(implicit trace: Trace): ZStream[R, E, Chunk[A]]

Emits a sliding window of n elements.

Emits a sliding window of n elements.

 Stream(1, 2, 3, 4).sliding(2).runCollect // Chunk(Chunk(1, 2), Chunk(2, 3), Chunk(3, 4))

Attributes

def some[A2](implicit ev: A <:< Option[A2], trace: Trace): ZStream[R, Option[E], A2]

Converts an option on values into an option on errors.

Converts an option on values into an option on errors.

Attributes

def someOrElse[A2](default: => A2)(implicit ev: A <:< Option[A2], trace: Trace): ZStream[R, E, A2]

Extracts the optional value, or returns the given 'default'.

Extracts the optional value, or returns the given 'default'.

Attributes

def someOrFail[A2, E1 >: E](e: => E1)(implicit ev: A <:< Option[A2], trace: Trace): ZStream[R, E1, A2]

Extracts the optional value, or fails with the given error 'e'.

Extracts the optional value, or fails with the given error 'e'.

Attributes

def split(f: A => Boolean)(implicit trace: Trace): ZStream[R, E, Chunk[A]]

Splits elements based on a predicate.

Splits elements based on a predicate.

 ZStream.range(1, 10).split(_ % 4 == 0).runCollect // Chunk(Chunk(1, 2, 3), Chunk(5, 6, 7), Chunk(9))

Attributes

def splitOnChunk[A1 >: A](delimiter: => Chunk[A1])(implicit trace: Trace): ZStream[R, E, Chunk[A]]

Splits elements on a delimiter and transforms the splits into desired output.

Splits elements on a delimiter and transforms the splits into desired output.

Attributes

def take(n: => Long)(implicit trace: Trace): ZStream[R, E, A]

Takes the specified number of elements from this stream.

Takes the specified number of elements from this stream.

Attributes

def takeRight(n: => Int)(implicit trace: Trace): ZStream[R, E, A]

Takes the last specified number of elements from this stream.

Takes the last specified number of elements from this stream.

Attributes

def takeUntil(f: A => Boolean)(implicit trace: Trace): ZStream[R, E, A]

Takes all elements of the stream until the specified predicate evaluates to true.

Takes all elements of the stream until the specified predicate evaluates to true.

Attributes

def takeUntilZIO[R1 <: R, E1 >: E](f: A => ZIO[R1, E1, Boolean])(implicit trace: Trace): 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.

Attributes

def takeWhile(f: A => Boolean)(implicit trace: Trace): ZStream[R, E, A]

Takes all elements of the stream for as long as the specified predicate evaluates to true.

Takes all elements of the stream for as long as the specified predicate evaluates to true.

Attributes

def tap[R1 <: R, E1 >: E](f: A => ZIO[R1, E1, Any])(implicit trace: Trace): ZStream[R1, E1, A]

Adds an effect to consumption of every element of the stream.

Adds an effect to consumption of every element of the stream.

Attributes

def tapError[R1 <: R, E1 >: E](f: E => ZIO[R1, E1, Any])(implicit ev: CanFail[E], trace: Trace): ZStream[R1, E1, A]

Returns a stream that effectfully "peeks" at the failure of the stream.

Returns a stream that effectfully "peeks" at the failure of the stream.

Attributes

def tapErrorCause[R1 <: R, E1 >: E](f: Cause[E] => ZIO[R1, E1, Any])(implicit ev: CanFail[E], trace: Trace): ZStream[R1, E1, A]

Returns a stream that effectfully "peeks" at the cause of failure of the stream.

Returns a stream that effectfully "peeks" at the cause of failure of the stream.

Attributes

def tapSink[R1 <: R, E1 >: E](sink: => ZSink[R1, E1, A, Any, Any])(implicit trace: Trace): ZStream[R1, E1, A]

Sends all elements emitted by this stream to the specified sink in addition to emitting them.

Sends all elements emitted by this stream to the specified sink in addition to emitting them.

Attributes

def throttleEnforce(units: => Long, duration: => Duration, burst: => Long)(costFn: Chunk[A] => Long)(implicit trace: Trace): ZStream[R, E, A]

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 + burst threshold. Chunks that do not meet the bandwidth constraints are dropped. The weight of each chunk is determined by the costFn function.

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 + burst threshold. Chunks that do not meet the bandwidth constraints are dropped. The weight of each chunk is determined by the costFn function.

Attributes

def throttleEnforceZIO[R1 <: R, E1 >: E](units: => Long, duration: => Duration, burst: => Long)(costFn: Chunk[A] => ZIO[R1, E1, Long])(implicit trace: Trace): ZStream[R1, E1, A]

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 + burst threshold. Chunks that do not meet the bandwidth constraints are dropped. The weight of each chunk is determined by the costFn effectful function.

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 + burst threshold. Chunks that do not meet the bandwidth constraints are dropped. The weight of each chunk is determined by the costFn effectful function.

Attributes

def throttleShape(units: => Long, duration: => Duration, burst: => Long)(costFn: Chunk[A] => Long)(implicit trace: Trace): ZStream[R, E, A]

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 + burst threshold. The weight of each chunk is determined by the costFn function.

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 + burst threshold. The weight of each chunk is determined by the costFn function.

Attributes

def throttleShapeZIO[R1 <: R, E1 >: E](units: => Long, duration: => Duration, burst: => Long)(costFn: Chunk[A] => ZIO[R1, E1, Long])(implicit trace: Trace): ZStream[R1, E1, A]

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 + burst threshold. The weight of each chunk is determined by the costFn effectful function.

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 + burst threshold. The weight of each chunk is determined by the costFn effectful function.

Attributes

def timeout(d: => Duration)(implicit trace: Trace): ZStream[R, E, A]

Ends the stream if it does not produce a value after d duration.

Ends the stream if it does not produce a value after d duration.

Attributes

def timeoutFail[E1 >: E](e: => E1)(d: Duration)(implicit trace: Trace): ZStream[R, E1, A]

Fails the stream with given error if it does not produce a value after d duration.

Fails the stream with given error if it does not produce a value after d duration.

Attributes

def timeoutFailCause[E1 >: E](cause: => Cause[E1])(d: => Duration)(implicit trace: Trace): ZStream[R, E1, A]

Fails the stream with given cause if it does not produce a value after d duration.

Fails the stream with given cause if it does not produce a value after d duration.

Attributes

def timeoutTo[R1 <: R, E1 >: E, A2 >: A](d: => Duration)(that: => ZStream[R1, E1, A2])(implicit trace: Trace): ZStream[R1, E1, A2]

Switches the stream if it does not produce a value after d duration.

Switches the stream if it does not produce a value after d duration.

Attributes

def toChannel: ZChannel[R, Any, Any, Any, E, Chunk[A], Any]

Converts the stream to its underlying channel

Converts the stream to its underlying channel

Attributes

def toHub[E1 >: E, A1 >: A](capacity: => Int)(implicit trace: Trace): ZIO[R & Scope, Nothing, Hub[Take[E1, A1]]]

Converts the stream to a scoped hub of chunks. After the scope is closed, the hub will never again produce values and should be discarded.

Converts the stream to a scoped hub of chunks. After the scope is closed, the hub will never again produce values and should be discarded.

Attributes

def toInputStream(implicit ev0: E <:< Throwable, ev1: A <:< Byte, trace: Trace): ZIO[R & Scope, E, InputStream]

Converts this stream of bytes into a java.io.InputStream wrapped in a scoped ZIO. The returned input stream will only be valid within the scope.

Converts this stream of bytes into a java.io.InputStream wrapped in a scoped ZIO. The returned input stream will only be valid within the scope.

Attributes

def toIterator(implicit trace: Trace): ZIO[R & Scope, Nothing, Iterator[Either[E, A]]]

Converts this stream into a scala.collection.Iterator wrapped in a scoped ZIO. The returned iterator will only be valid within the scope.

Converts this stream into a scala.collection.Iterator wrapped in a scoped ZIO. The returned iterator will only be valid within the scope.

Attributes

def toPull(implicit trace: Trace): ZIO[R & Scope, Nothing, ZIO[R, Option[E], Chunk[A]]]

Returns in a scope a ZIO effect that can be used to repeatedly pull chunks from the stream. The pull effect fails with None when the stream is finished, or with Some error if it fails, otherwise it returns a chunk of the stream's output.

Returns in a scope a ZIO effect that can be used to repeatedly pull chunks from the stream. The pull effect fails with None when the stream is finished, or with Some error if it fails, otherwise it returns a chunk of the stream's output.

Attributes

def toQueue(capacity: => Int)(implicit trace: Trace): ZIO[R & Scope, Nothing, Dequeue[Take[E, A]]]

Converts the stream to a scoped queue of chunks. After the scope is closed, the queue will never again produce values and should be discarded.

Converts the stream to a scoped queue of chunks. After the scope is closed, the queue will never again produce values and should be discarded.

Attributes

def toQueueDropping(capacity: => Int)(implicit trace: Trace): ZIO[R & Scope, Nothing, Dequeue[Take[E, A]]]

Converts the stream to a dropping scoped queue of chunks. After the scope is closed, the queue will never again produce values and should be discarded.

Converts the stream to a dropping scoped queue of chunks. After the scope is closed, the queue will never again produce values and should be discarded.

Attributes

def toQueueOfElements(capacity: => Int)(implicit trace: Trace): ZIO[R & Scope, Nothing, Dequeue[Exit[Option[E], A]]]

Converts the stream to a scoped queue of elements. After the scope is closed, the queue will never again produce values and should be discarded.

Converts the stream to a scoped queue of elements. After the scope is closed, the queue will never again produce values and should be discarded.

Attributes

def toQueueSliding(capacity: => Int)(implicit trace: Trace): ZIO[R & Scope, Nothing, Dequeue[Take[E, A]]]

Converts the stream to a sliding scoped queue of chunks. After the scope is closed, the queue will never again produce values and should be discarded.

Converts the stream to a sliding scoped queue of chunks. After the scope is closed, the queue will never again produce values and should be discarded.

Attributes

def toQueueUnbounded(implicit trace: Trace): ZIO[R & Scope, Nothing, Dequeue[Take[E, A]]]

Converts the stream into an unbounded scoped queue. After the scope is closed, the queue will never again produce values and should be discarded.

Converts the stream into an unbounded scoped queue. After the scope is closed, the queue will never again produce values and should be discarded.

Attributes

def toReader(implicit ev0: E <:< Throwable, ev1: A <:< Char, trace: Trace): ZIO[R & Scope, E, Reader]

Converts this stream of chars into a java.io.Reader wrapped in a scoped ZIO. The returned reader will only be valid within the scope.

Converts this stream of chars into a java.io.Reader wrapped in a scoped ZIO. The returned reader will only be valid within the scope.

Attributes

def transduce[R1 <: R, E1 >: E, A1 >: A, Z](sink: => ZSink[R1, E1, A1, A1, Z])(implicit trace: Trace): ZStream[R1, E1, Z]

Applies the transducer to the stream and emits its outputs.

Applies the transducer to the stream and emits its outputs.

Attributes

def updateService[M]: UpdateService[R, E, A, M]

Updates a service in the environment of this effect.

Updates a service in the environment of this effect.

Attributes

def updateServiceAt[Service]: UpdateServiceAt[R, E, A, Service]

Updates a service at the specified key in the environment of this effect.

Updates a service at the specified key in the environment of this effect.

Attributes

def via[R1 <: R, E1 >: E, B](pipeline: => ZPipeline[R1, E1, A, B])(implicit trace: Trace): ZStream[R1, E1, B]

Threads the stream through a transformation pipeline.

Threads the stream through a transformation pipeline.

Attributes

def viaFunction[R2, E2, B](f: ZStream[R, E, A] => ZStream[R2, E2, B])(implicit trace: Trace): ZStream[R2, E2, B]

Threads the stream through the transformation function f.

Threads the stream through the transformation function f.

Attributes

def when(b: => Boolean)(implicit trace: Trace): ZStream[R, E, A]

Returns this stream if the specified condition is satisfied, otherwise returns an empty stream.

Returns this stream if the specified condition is satisfied, otherwise returns an empty stream.

Attributes

def whenZIO[R1 <: R, E1 >: E](b: => ZIO[R1, E1, Boolean])(implicit trace: Trace): ZStream[R1, E1, A]

Returns this stream if the specified effectful condition is satisfied, otherwise returns an empty stream.

Returns this stream if the specified effectful condition is satisfied, otherwise returns an empty stream.

Attributes

def withFilter(predicate: A => Boolean)(implicit trace: Trace): ZStream[R, E, A]

Equivalent to filter but enables the use of filter clauses in for-comprehensions

Equivalent to filter but enables the use of filter clauses in for-comprehensions

Attributes

def zip[R1 <: R, E1 >: E, A2](that: => ZStream[R1, E1, A2])(implicit zippable: Zippable[A, A2], trace: Trace): 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.

Attributes

def zipAll[R1 <: R, E1 >: E, A1 >: A, A2](that: => ZStream[R1, E1, A2])(defaultLeft: => A1, defaultRight: => A2)(implicit trace: Trace): 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 defaultLeft and defaultRight will be used if the streams have different lengths and one of the streams has ended before the other.

Attributes

def zipAllLeft[R1 <: R, E1 >: E, A1 >: A, A2](that: => ZStream[R1, E1, A2])(default: => A1)(implicit trace: Trace): 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.

Attributes

def zipAllRight[R1 <: R, E1 >: E, A2](that: => ZStream[R1, E1, A2])(default: => A2)(implicit trace: Trace): 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.

Attributes

def zipAllSortedByKey[R1 <: R, E1 >: E, B](that: => ZStream[R1, E1, (K, B)])(defaultLeft: => A, defaultRight: => B)(implicit ord: Ordering[K], trace: Trace): ZStream[R1, E1, (K, (A, B))]
Implicitly added by SortedByKey

Zips this stream that is sorted by distinct keys and the specified stream that is sorted by distinct keys to produce a new stream that is sorted by distinct keys. Combines values associated with each key into a tuple, using the specified values defaultLeft and defaultRight to fill in missing values.

Zips this stream that is sorted by distinct keys and the specified stream that is sorted by distinct keys to produce a new stream that is sorted by distinct keys. Combines values associated with each key into a tuple, using the specified values defaultLeft and defaultRight to fill in missing values.

This allows zipping potentially unbounded streams of data by key in constant space but the caller is responsible for ensuring that the streams are sorted by distinct keys.

Attributes

def zipAllSortedByKeyLeft[R1 <: R, E1 >: E, B](that: => ZStream[R1, E1, (K, B)])(default: => A)(implicit ord: Ordering[K], trace: Trace): ZStream[R1, E1, (K, A)]
Implicitly added by SortedByKey

Zips this stream that is sorted by distinct keys and the specified stream that is sorted by distinct keys to produce a new stream that is sorted by distinct keys. Keeps only values from this stream, using the specified value default to fill in missing values.

Zips this stream that is sorted by distinct keys and the specified stream that is sorted by distinct keys to produce a new stream that is sorted by distinct keys. Keeps only values from this stream, using the specified value default to fill in missing values.

This allows zipping potentially unbounded streams of data by key in constant space but the caller is responsible for ensuring that the streams are sorted by distinct keys.

Attributes

def zipAllSortedByKeyRight[R1 <: R, E1 >: E, B](that: => ZStream[R1, E1, (K, B)])(default: => B)(implicit ord: Ordering[K], trace: Trace): ZStream[R1, E1, (K, B)]
Implicitly added by SortedByKey

Zips this stream that is sorted by distinct keys and the specified stream that is sorted by distinct keys to produce a new stream that is sorted by distinct keys. Keeps only values from that stream, using the specified value default to fill in missing values.

Zips this stream that is sorted by distinct keys and the specified stream that is sorted by distinct keys to produce a new stream that is sorted by distinct keys. Keeps only values from that stream, using the specified value default to fill in missing values.

This allows zipping potentially unbounded streams of data by key in constant space but the caller is responsible for ensuring that the streams are sorted by distinct keys.

Attributes

def zipAllSortedByKeyWith[R1 <: R, E1 >: E, B, C](that: => ZStream[R1, E1, (K, B)])(left: A => C, right: B => C)(both: (A, B) => C)(implicit ord: Ordering[K], trace: Trace): ZStream[R1, E1, (K, C)]
Implicitly added by SortedByKey

Zips this stream that is sorted by distinct keys and the specified stream that is sorted by distinct keys to produce a new stream that is sorted by distinct keys. Uses the functions left, right, and both to handle the cases where a key and value exist in this stream, that stream, or both streams.

Zips this stream that is sorted by distinct keys and the specified stream that is sorted by distinct keys to produce a new stream that is sorted by distinct keys. Uses the functions left, right, and both to handle the cases where a key and value exist in this stream, that stream, or both streams.

This allows zipping potentially unbounded streams of data by key in constant space but the caller is responsible for ensuring that the streams are sorted by distinct keys.

Attributes

def zipAllWith[R1 <: R, E1 >: E, A2, A3](that: => ZStream[R1, E1, A2])(left: A => A3, right: A2 => A3)(both: (A, A2) => A3)(implicit trace: Trace): ZStream[R1, E1, A3]

Zips this stream with another point-wise. The provided functions will be used to create elements for the composed stream.

Zips this stream with another point-wise. The provided functions will be used to create elements for the composed stream.

The functions left and right will be used if the streams have different lengths and one of the streams has ended before the other.

Attributes

def zipLatest[R1 <: R, E1 >: E, A2, A3](that: => ZStream[R1, E1, A2])(implicit zippable: Zippable[A, A2], trace: Trace): ZStream[R1, E1, Out]

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.

Attributes

def zipLatestWith[R1 <: R, E1 >: E, A2, A3](that: => ZStream[R1, E1, A2])(f: (A, A2) => A3)(implicit trace: Trace): 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.

Attributes

def zipLeft[R1 <: R, E1 >: E, A2](that: => ZStream[R1, E1, A2])(implicit trace: Trace): 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.

Attributes

def zipRight[R1 <: R, E1 >: E, A2](that: => ZStream[R1, E1, A2])(implicit trace: Trace): 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.

Attributes

def zipWith[R1 <: R, E1 >: E, A2, A3](that: => ZStream[R1, E1, A2])(f: (A, A2) => A3)(implicit trace: Trace): 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.

Attributes

def zipWithChunks[R1 <: R, E1 >: E, A1 >: A, A2, A3](that: => ZStream[R1, E1, A2])(f: (Chunk[A1], Chunk[A2]) => (Chunk[A3], Either[Chunk[A1], Chunk[A2]]))(implicit trace: Trace): 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.

Attributes

def zipWithIndex(implicit trace: Trace): ZStream[R, E, (A, Long)]

Zips this stream together with the index of elements.

Zips this stream together with the index of elements.

Attributes

def zipWithNext(implicit trace: Trace): ZStream[R, E, (A, Option[A])]

Zips each element with the next element if present.

Zips each element with the next element if present.

Attributes

def zipWithPrevious(implicit trace: Trace): ZStream[R, E, (Option[A], A)]

Zips each element with the previous element. Initially accompanied by None.

Zips each element with the previous element. Initially accompanied by None.

Attributes

def zipWithPreviousAndNext(implicit trace: Trace): ZStream[R, E, (Option[A], A, Option[A])]

Zips each element with both the previous and next element.

Zips each element with both the previous and next element.

Attributes

Deprecated methods

def zipWithLatest[R1 <: R, E1 >: E, A2, A3](that: => ZStream[R1, E1, A2])(f: (A, A2) => A3)(implicit trace: Trace): 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.

Attributes

Deprecated
true

Concrete fields

val channel: ZChannel[R, Any, Any, Any, E, Chunk[A], Any]