Creates a sink that waits for a single value to be produced.
Creates a sink accumulating incoming values into a list.
Creates a sink accumulating incoming values into a list of maximum size n.
Creates a sink accumulating incoming values into a map.
Creates a sink accumulating incoming values into a map. Key of each element is determined by supplied function.
Creates a sink accumulating incoming values into a map of maximum size n.
Creates a sink accumulating incoming values into a map of maximum size n.
Key of each element is determined by supplied function.
Creates a sink accumulating incoming values into a set.
Creates a sink accumulating incoming values into a set of maximum size n.
Accumulates incoming elements into a list as long as they verify predicate p.
Accumulates incoming elements into a list as long as they verify effectful predicate p.
Creates a sink halting with the specified Throwable.
Creates a sink halting with the specified message, wrapped in a
RuntimeException.
Creates a sink consuming all incoming values until completion.
Creates a sink failing with a value of type E.
Creates a sink by folding over a structure of type S.
Creates a sink by folding over a structure of type S.
Creates a sink by effectully folding over a structure of type S.
Creates a sink by effectfully folding over a structure of type S.
Creates a sink that folds elements of type A into a structure
of type S until max elements have been folded.
Creates a sink that folds elements of type A into a structure
of type S until max elements have been folded.
Like ZSink.foldWeighted, but with a constant cost function of 1.
Creates a sink that effectfully folds elements of type A into a structure
of type S until max elements have been folded.
Creates a sink that effectfully folds elements of type A into a structure
of type S until max elements have been folded.
Like ZSink.foldWeightedM, but with a constant cost function of 1.
Creates a sink that folds elements of type A 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 A 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
cause the stream to hang. See ZSink.foldWeightedDecompose for
a variant that can handle these.
Creates a sink that folds elements of type A 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 A 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( Sink .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).
The ZSink.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 A 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 A 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. See
ZSink.foldWeightedDecompose for an example.
Creates a sink that effectfully folds elements of type A 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 A 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
cause the stream to hang. See ZSink.foldWeightedDecomposeM for
a variant that can handle these.
Creates a single-value sink produced from an effect
Creates a sink that purely transforms incoming values.
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.
Creates a sink halting with a specified cause.
Creates a sink by that merely passes on incoming values.
Creates a sink by starts consuming value as soon as one fails
the predicate p.
Creates a sink by starts consuming value as soon as one fails
the effectful predicate p.
Returns a sink that must at least perform one extraction or else
will "fail" with end.
Creates a sink that consumes the first value verifying the predicate p
or fails as soon as the sink won't make any more progress.
Splits strings on newlines.
Splits strings on newlines. Handles both \r\n and \n.
Merges chunks of strings and splits them on newlines.
Merges chunks of strings and splits them on newlines. Handles both
\r\n and \n.
Creates a single-value sink from a value.
Creates a sink which throttles input elements of type A according to the given bandwidth parameters using the token bucket algorithm.
Creates a sink which throttles input elements of type A according to the given bandwidth parameters
using the token bucket algorithm. The sink allows for burst in the processing of elements by allowing
the token bucket to accumulate tokens up to a units + burst threshold. Elements that do not meet the
bandwidth constraints are dropped. The weight of each element is determined by the costFn function.
Elements are mapped to Option[A], and None denotes that a given element has been dropped.
Creates a sink which throttles input elements of type A according to the given bandwidth parameters using the token bucket algorithm.
Creates a sink which throttles input elements of type A according to the given bandwidth parameters
using the token bucket algorithm. The sink allows for burst in the processing of elements by allowing
the token bucket to accumulate tokens up to a units + burst threshold. Elements that do not meet the
bandwidth constraints are dropped. The weight of each element is determined by the costFn effectful function.
Elements are mapped to Option[A], and None denotes that a given element has been dropped.
Creates a sink which delays input elements of type A according to the given bandwidth parameters using the token bucket algorithm.
Creates a sink which delays input elements of type A according to the given bandwidth parameters
using the token bucket algorithm. The sink 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 element is
determined by the costFn function.
Creates a sink which delays input elements of type A according to the given bandwidth parameters using the token bucket algorithm.
Creates a sink which delays input elements of type A according to the given bandwidth parameters
using the token bucket algorithm. The sink 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 element is
determined by the costFn effectful function.
Decodes individual bytes into a String using UTF-8.
Decodes individual bytes into a String using UTF-8. Up to bufferSize bytes
will be buffered by the sink.
This sink uses the String constructor's behavior when handling malformed byte sequences.
Decodes chunks of bytes into a String.
Decodes chunks of bytes into a String.
This sink uses the String constructor's behavior when handling malformed byte sequences.