A sink that collects first n elements into a chunk.
A sink that collects first n elements into a chunk. Note that the chunk
is preallocated and must fit in memory.
A sink that collects all of its inputs into a map.
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 first n keys into a map.
A sink that collects first n keys into a map. The keys are calculated
from inputs using the keying function key; if multiple inputs use the the
same key, they are merged using the f function.
A sink that collects all of its inputs into a set.
A sink that collects first n distinct inputs into a set.
Accumulates incoming elements into a chunk as long as they verify predicate
p.
Accumulates incoming elements into a chunk as long as they verify effectful
predicate p.
A sink that counts the number of elements fed to it.
Creates a sink halting with the specified Throwable.
Creates a sink halting with the specified message, wrapped in a
RuntimeException.
Creates a sink which digests incoming bytes using Java's MessageDigest class, returning the digest value.
Creates a sink which digests incoming bytes using Java's MessageDigest class, returning the digest value.
A sink that ignores its inputs.
Accesses the environment of the sink in the context of a sink.
A sink that always fails with the specified error.
Creates a sink halting with a specified cause.
A sink that folds its inputs with the provided function, termination predicate and initial state.
A sink that folds its input chunks with the provided function, termination predicate and initial state.
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 effectfully folds its input chunks with the provided function, termination predicate and initial state.
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 folds its inputs with the provided function and initial state.
A sink that folds its input chunks with the provided function and initial state.
A sink that 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.
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 inputs with the provided function and initial state.
Creates a sink that folds elements of type In into a structure of type
S until max elements have been folded.
Creates a sink that folds elements of type In into a structure of type
S until max elements have been folded.
Like foldWeighted, but with a constant cost function of 1.
Creates a sink that effectfully folds elements of type In into a
structure of type S until max elements have been folded.
Creates a sink that effectfully folds elements of type In into a
structure of type S until max elements have been folded.
Like foldWeightedM, but with a constant cost function of 1.
Creates a sink that folds elements of type In into a structure of type
S, until max worth of elements (determined by the costFn) have been
folded.
Creates a sink that folds elements of type In into a structure of type
S, until max worth of elements (determined by the costFn) have been
folded.
Elements that have an individual cost larger than max will force the
sink to cross the max cost. See foldWeightedDecompose for a variant
that can handle these cases.
Creates a sink that folds elements of type In into a structure of type
S, until max worth of elements (determined by the costFn) have been
folded.
Creates a sink that folds elements of type In into a structure of type
S, until max worth of elements (determined by the costFn) have been
folded.
The decompose function will be used for decomposing elements that cause
an S aggregate to cross max into smaller elements. For example:
Stream(1, 5, 1) .transduce( ZSink .foldWeightedDecompose(List[Int]())((i: Int) => i.toLong, 4, (i: Int) => Chunk(i - 1, 1)) { (acc, el) => el :: acc } .map(_.reverse) ) .runCollect
The stream would emit the elements List(1), List(4), List(1, 1).
Be vigilant with this function, it has to generate "simpler" values or the
fold may never end. A value is considered indivisible if decompose yields
the empty chunk or a single-valued chunk. In these cases, there is no other
choice than to yield a value that will cross the threshold.
The foldWeightedDecomposeM allows the decompose function to return a
ZIO value, and consequently it allows the sink to fail.
Creates a sink that effectfully folds elements of type In into a
structure of type S, until max worth of elements (determined by the
costFn) have been folded.
Creates a sink that effectfully folds elements of type In into a
structure of type S, until max worth of elements (determined by the
costFn) have been folded.
The decompose function will be used for decomposing elements that cause
an S aggregate to cross max into smaller elements. Be vigilant with
this function, it has to generate "simpler" values or the fold may never
end. A value is considered indivisible if decompose yields the empty
chunk or a single-valued chunk. In these cases, there is no other choice
than to yield a value that will cross the threshold.
See foldWeightedDecompose for an example.
Creates a sink that effectfully folds elements of type In into a
structure of type S, until max worth of elements (determined by the
costFn) have been folded.
Creates a sink that effectfully folds elements of type In into a
structure of type S, until max worth of elements (determined by the
costFn) have been folded.
Elements that have an individual cost larger than max will force the
sink to cross the max cost. See foldWeightedDecomposeM for a
variant that can handle these cases.
A sink that effectfully folds its inputs with the provided function, termination predicate and initial state.
A sink that executes the provided effectful function for every element fed to it.
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 until f evaluates to false.
A sink that executes the provided effectful function for every element fed
to it until f evaluates to false.
Uses the provided File to create a ZSink that consumes byte chunks
and writes them to the File.
Uses the provided File to create a ZSink that consumes byte chunks
and writes them to the File. The sink will yield count of bytes written.
Uses the provided Path represented as a string to create a ZSink that
consumes byte chunks and writes them to the File.
Uses the provided Path represented as a string to create a ZSink that
consumes byte chunks and writes them to the File. The sink will yield
count of bytes written.
Uses the provided URI to create a ZSink that consumes byte chunks and
writes them to the File.
Uses the provided URI to create a ZSink that consumes byte chunks and
writes them to the File. The sink will yield count of bytes written.
Create a sink which publishes each element to the specified hub.
Create a sink which publishes each element to the specified hub.
Create a sink which publishes each element to the specified hub. The hub will be shutdown once the stream is closed.
Uses the provided OutputStream to create a ZSink that consumes byte
chunks and writes them to the OutputStream.
Uses the provided OutputStream to create a ZSink that consumes byte
chunks and writes them to the OutputStream. The sink will yield the count
of bytes written.
The caller of this function is responsible for closing the OutputStream.
Uses the provided OutputStream resource to create a ZSink that
consumes byte chunks and writes them to the OutputStream.
Uses the provided OutputStream resource to create a ZSink that
consumes byte chunks and writes them to the OutputStream. The sink will
yield the count of bytes written.
The OutputStream will be automatically closed after the stream is
finished or an error occurred.
Uses the provided Path to create a ZSink that consumes byte chunks
and writes them to the File.
Uses the provided Path to create a ZSink that consumes byte chunks
and writes them to the File. The sink will yield count of bytes written.
Create a sink which enqueues each element into the specified queue.
Create a sink which enqueues each element into the specified queue.
Create a sink which enqueues each element into the specified queue. The queue will be shutdown once the stream is closed.
Creates a single-value sink produced from an effect
Creates a sink containing the first value.
Creates a sink containing the last value.
A sink that immediately ends with the specified value.
A sink that sums incoming numeric values.
Returns a lazily constructed sink that may require effects for its creation.
A sink that takes the specified number of values.
Creates a sink produced from an effect.
Creates a sink produced from a managed effect.
Accumulates incoming elements into a chunk as long as they verify effectful
predicate p.
Accumulates incoming elements into a chunk as long as they verify effectful
predicate p.
(Since version 2.0.0) use collectAllWhileZIO
(Since version 2.0.0) use dropWhileZIO
Returns a lazily constructed sink that may require effects for its creation.
Returns a lazily constructed sink that may require effects for its creation.
(Since version 2.0.0) use suspend
Returns a sink that executes a total effect and ends with its result.
Returns a sink that executes a total effect and ends with its result.
(Since version 2.0.0) use succeed
A sink that effectfully folds its input chunks with the provided function, termination predicate and initial state.
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.
(Since version 2.0.0) use foldChunksZIO
A sink that effectfully folds its input chunks with the provided function and initial state.
A sink that effectfully folds its input chunks with the provided function
and initial state. f must preserve chunking-invariance.
(Since version 2.0.0) use foldLeftChunksZIO
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.
(Since version 2.0.0) use foldLeftZIO
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.
(Since version 2.0.0) use foldZIO
Creates a sink that effectfully folds elements of type In into a
structure of type S until max elements have been folded.
Creates a sink that effectfully folds elements of type In into a
structure of type S until max elements have been folded.
Like foldWeightedM, but with a constant cost function of 1.
(Since version 2.0.0) use foldUntilZIO
Creates a sink that effectfully folds elements of type In into a
structure of type S, until max worth of elements (determined by the
costFn) have been folded.
Creates a sink that effectfully folds elements of type In into a
structure of type S, until max worth of elements (determined by the
costFn) have been folded.
The decompose function will be used for decomposing elements that cause
an S aggregate to cross max into smaller elements. Be vigilant with
this function, it has to generate "simpler" values or the fold may never
end. A value is considered indivisible if decompose yields the empty
chunk or a single-valued chunk. In these cases, there is no other choice
than to yield a value that will cross the threshold.
See foldWeightedDecompose for an example.
(Since version 2.0.0) use foldWeightedDecomposeZIO
Creates a sink that effectfully folds elements of type In into a
structure of type S, until max worth of elements (determined by the
costFn) have been folded.
Creates a sink that effectfully folds elements of type In into a
structure of type S, until max worth of elements (determined by the
costFn) have been folded.
(Since version 2.0.0-) use foldWeightedZIO
Elements that have an individual cost larger than max will force the
sink to cross the max cost. See foldWeightedDecomposeM for a
variant that can handle these cases.
Creates a single-value sink produced from an effect
Creates a single-value sink produced from an effect
(Since version 2.0.0) use fromZIO
Creates a sink halting with a specified cause.
Creates a sink halting with a specified cause.
(Since version 2.0.0) use failCause
(Since version 2.0.0) use unwrapManaged