ZSink

Companion:
class
class Object
trait Matchable
class Any
ZSink.type

Type members

Classlikes

final class AccessSinkPartiallyApplied[R](dummy: Boolean) extends AnyVal
object Push

Types

type Push[-R, +E, -I, +L, +Z] = Option[Chunk[I]] => ZIO[R, (Either[E, Z], Chunk[L]), Unit]

Value members

Concrete methods

Accesses the environment of the sink in the context of a sink.

Accesses the environment of the sink in the context of a sink.

def apply[R, E, I, L, Z](push: ZManaged[R, Nothing, (R, E, I, L) => Z]): ZSink[R, E, I, L, Z]
def collectAll[A]: ZSink[Any, Nothing, A, Nothing, Chunk[A]]

A sink that collects all of its inputs into a chunk.

A sink that collects all of its inputs into a chunk.

def collectAllToMap[A, K](key: A => K)(f: (A, A) => A): ZSink[Any, Nothing, A, Nothing, Map[K, A]]

A sink that collects all of its inputs into a map. The keys are extracted from inputs using the keying function key; if multiple inputs use the same key, they are merged using the f function.

A sink that collects all of its inputs into a map. The keys are extracted from inputs using the keying function key; if multiple inputs use the same key, they are merged using the f function.

def collectAllToSet[A]: ZSink[Any, Nothing, A, Nothing, Set[A]]

A sink that collects all of its inputs into a set.

A sink that collects all of its inputs into a set.

def die(e: => Throwable): ZSink[Any, Nothing, Any, Nothing, Nothing]

Creates a sink halting with the specified Throwable.

Creates a sink halting with the specified Throwable.

def dieMessage(m: => String): ZSink[Any, Nothing, Any, Nothing, Nothing]

Creates a sink halting with the specified message, wrapped in a RuntimeException.

Creates a sink halting with the specified message, wrapped in a RuntimeException.

def fail[E, I](e: => E): ZSink[Any, E, I, I, Nothing]

A sink that always fails with the specified error.

A sink that always fails with the specified error.

def fold[I, S](z: S)(contFn: S => Boolean)(f: (S, I) => S): ZSink[Any, Nothing, I, I, S]

A sink that folds its inputs with the provided function, termination predicate and initial state.

A sink that folds its inputs with the provided function, termination predicate and initial state.

def foldChunks[I, S](z: S)(contFn: S => Boolean)(f: (S, Chunk[I]) => S): ZSink[Any, Nothing, I, I, S]

A sink that folds its input chunks with the provided function, termination predicate and initial state. contFn condition is checked only for the initial value and at the end of processing of each chunk. f and contFn must preserve chunking-invariance.

A sink that folds its input chunks with the provided function, termination predicate and initial state. contFn condition is checked only for the initial value and at the end of processing of each chunk. f and contFn must preserve chunking-invariance.

def foldChunksM[R, E, I, S](z: S)(contFn: S => Boolean)(f: (S, Chunk[I]) => ZIO[R, E, S]): ZSink[R, E, I, I, S]

A sink that effectfully folds its input chunks with the provided function, termination predicate and initial state. contFn condition is checked only for the initial value and at the end of processing of each chunk. f and contFn must preserve chunking-invariance.

A sink that effectfully folds its input chunks with the provided function, termination predicate and initial state. contFn condition is checked only for the initial value and at the end of processing of each chunk. f and contFn must preserve chunking-invariance.

def foldLeft[I, S](z: S)(f: (S, I) => S): ZSink[Any, Nothing, I, Nothing, S]

A sink that folds its inputs with the provided function and initial state.

A sink that folds its inputs with the provided function and initial state.

def foldLeftChunks[I, S](z: S)(f: (S, Chunk[I]) => S): ZSink[Any, Nothing, I, Nothing, S]

A sink that folds its input chunks with the provided function and initial state. f must preserve chunking-invariance.

A sink that folds its input chunks with the provided function and initial state. f must preserve chunking-invariance.

def foldLeftChunksM[R, E, I, S](z: S)(f: (S, Chunk[I]) => ZIO[R, E, S]): ZSink[R, E, I, Nothing, S]

A sink that effectfully folds its input chunks with the provided function and initial state. f must preserve chunking-invariance.

A sink that effectfully folds its input chunks with the provided function and initial state. f must preserve chunking-invariance.

def foldLeftM[R, E, I, S](z: S)(f: (S, I) => ZIO[R, E, S]): ZSink[R, E, I, I, S]

A sink that effectfully folds its inputs with the provided function and initial state.

A sink that effectfully folds its inputs with the provided function and initial state.

def foldM[R, E, I, S](z: S)(contFn: S => Boolean)(f: (S, I) => ZIO[R, E, S]): ZSink[R, E, I, I, S]

A sink that effectfully folds its inputs with the provided function, termination predicate and initial state.

A sink that effectfully folds its inputs with the provided function, termination predicate and initial state.

This sink may terminate in the middle of a chunk and discard the rest of it. See the discussion on the ZSink class scaladoc on sinks vs. transducers.

def foreach[R, E, I](f: I => ZIO[R, E, Any]): ZSink[R, E, I, I, Unit]

A sink that executes the provided effectful function for every element fed to it.

A sink that executes the provided effectful function for every element fed to it.

def foreachChunk[R, E, I](f: Chunk[I] => ZIO[R, E, Any]): ZSink[R, E, I, Nothing, Unit]

A sink that executes the provided effectful function for every chunk fed to it.

A sink that executes the provided effectful function for every chunk fed to it.

final def foreachWhile[R, E, I](f: I => ZIO[R, E, Boolean]): ZSink[R, E, I, I, Unit]

A sink that executes the provided effectful function for every element fed to it until f evaluates to false.

A sink that executes the provided effectful function for every element fed to it until f evaluates to false.

def fromEffect[R, E, I, Z](b: => ZIO[R, E, Z]): ZSink[R, E, I, I, Z]

Creates a single-value sink produced from an effect

Creates a single-value sink produced from an effect

def fromHub[R, E, I](hub: ZHub[R, Nothing, E, Any, I, Any]): ZSink[R, E, I, Nothing, Unit]

Create a sink which publishes each element to the specified hub.

Create a sink which publishes each element to the specified hub.

def fromHubWithShutdown[R, E, I](hub: ZHub[R, Nothing, E, Any, I, Any]): ZSink[R, E, I, Nothing, Unit]

Create a sink which publishes each element to the specified hub. The hub will be shutdown once the stream is closed.

Create a sink which publishes each element to the specified hub. The hub will be shutdown once the stream is closed.

def fromPush[R, E, I, L, Z](sink: (R, E, I, L) => Z): ZSink[R, E, I, L, Z]
def fromQueue[R, E, I](queue: ZQueue[R, Nothing, E, Any, I, Any]): ZSink[R, E, I, Nothing, Unit]

Create a sink which enqueues each element into the specified queue.

Create a sink which enqueues each element into the specified queue.

def fromQueueWithShutdown[R, E, I](queue: ZQueue[R, Nothing, E, Any, I, Any]): ZSink[R, E, I, Nothing, Unit]

Create a sink which enqueues each element into the specified queue. The queue will be shutdown once the stream is closed.

Create a sink which enqueues each element into the specified queue. The queue will be shutdown once the stream is closed.

def halt[E](e: => Cause[E]): ZSink[Any, E, Any, Nothing, Nothing]

Creates a sink halting with a specified cause.

Creates a sink halting with a specified cause.

def head[I]: ZSink[Any, Nothing, I, I, Option[I]]

Creates a sink containing the first value.

Creates a sink containing the first value.

def last[I]: ZSink[Any, Nothing, I, Nothing, Option[I]]

Creates a sink containing the last value.

Creates a sink containing the last value.

def managed[R, E, I, A, L <: I, Z](resource: ZManaged[R, E, A])(fn: A => ZSink[R, E, I, L, Z]): ZSink[R, E, I, I, Z]

A sink that depends on another managed value resource will be finalized after the processing.

A sink that depends on another managed value resource will be finalized after the processing.

def succeed[I, Z](z: => Z): ZSink[Any, Nothing, I, I, Z]

A sink that immediately ends with the specified value.

A sink that immediately ends with the specified value.

def sum[A](implicit A: Numeric[A]): ZSink[Any, Nothing, A, Nothing, A]

A sink that sums incoming numeric values.

A sink that sums incoming numeric values.

def summarized[R, E, B, C](summary: ZIO[R, E, B])(f: (B, B) => C): ZSink[R, E, Any, Nothing, C]

A generalized version of timed.

A generalized version of timed.

def take[I](n: Int): ZSink[Any, Nothing, I, I, Chunk[I]]

A sink that takes the specified number of values.

A sink that takes the specified number of values.

def timed: ZSink[Clock, Nothing, Any, Nothing, Duration]

A sink with timed execution.

A sink with timed execution.

Concrete fields

val count: ZSink[Any, Nothing, Any, Nothing, Long]

A sink that counts the number of elements fed to it.

A sink that counts the number of elements fed to it.

val drain: ZSink[Any, Nothing, Any, Nothing, Unit]

A sink that ignores its inputs.

A sink that ignores its inputs.