object ZSink
- Alphabetic
- By Inheritance
- ZSink
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final class AccessSinkPartiallyApplied[R] extends AnyVal
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def accessSink[R]: AccessSinkPartiallyApplied[R]
Accesses the environment of the sink in the context of a sink.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def collectAll[Err, In](implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, Nothing, Chunk[In]]
- def collectAllN[Err, In](n: Int)(implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, In, Chunk[In]]
A sink that collects first
nelements into a chunk.A sink that collects first
nelements into a chunk. Note that the chunk is preallocated and must fit in memory. - def collectAllToMap[Err, In, K](key: (In) => K)(f: (In, In) => In)(implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, Nothing, Map[K, In]]
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 theffunction. - def collectAllToMapN[Err, In, K](n: Long)(key: (In) => K)(f: (In, In) => In)(implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, In, Map[K, In]]
A sink that collects first
nkeys into a map.A sink that collects first
nkeys into a map. The keys are calculated from inputs using the keying functionkey; if multiple inputs use the the same key, they are merged using theffunction. - def collectAllToSet[Err, In](implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, Nothing, Set[In]]
A sink that collects all of its inputs into a set.
- def collectAllToSetN[Err, In](n: Long)(implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, In, Set[In]]
A sink that collects first
ndistinct inputs into a set. - def collectAllWhile[Err, In](p: (In) => Boolean)(implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, In, Chunk[In]]
Accumulates incoming elements into a chunk as long as they verify predicate
p. - def collectAllWhileZIO[Env, Err, In](p: (In) => ZIO[Env, Err, Boolean])(implicit trace: ZTraceElement): ZSink[Env, Err, In, Err, In, Chunk[In]]
Accumulates incoming elements into a chunk as long as they verify effectful predicate
p. - def count[Err](implicit trace: ZTraceElement): ZSink[Any, Err, Any, Err, Nothing, Long]
A sink that counts the number of elements fed to it.
- def die(e: => Throwable)(implicit trace: ZTraceElement): ZSink[Any, Any, Any, Nothing, Nothing, Nothing]
Creates a sink halting with the specified
Throwable. - def dieMessage(m: => String)(implicit trace: ZTraceElement): ZSink[Any, Any, Any, Nothing, Nothing, Nothing]
Creates a sink halting with the specified message, wrapped in a
RuntimeException. - def drain[Err](implicit trace: ZTraceElement): ZSink[Any, Err, Any, Err, Nothing, Unit]
A sink that ignores its inputs.
- def dropWhile[Err, In](p: (In) => Boolean)(implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, In, Any]
- def dropWhileZIO[R, InErr, In](p: (In) => ZIO[R, InErr, Boolean])(implicit trace: ZTraceElement): ZSink[R, InErr, In, InErr, In, Any]
- def effectSuspendTotal[Env, InErr, In, OutErr, Leftover, Done](sink: => ZSink[Env, InErr, In, OutErr, Leftover, Done])(implicit trace: ZTraceElement): ZSink[Env, InErr, In, OutErr, Leftover, Done]
Returns a lazily constructed sink that may require effects for its creation.
- def effectTotal[A](a: => A)(implicit trace: ZTraceElement): ZSink[Any, Any, Any, Nothing, Nothing, A]
Returns a sink that executes a total effect and ends with its result.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def fail[E](e: => E)(implicit trace: ZTraceElement): ZSink[Any, Any, Any, E, Nothing, Nothing]
A sink that always fails with the specified error.
- def failCause[E](e: => Cause[E])(implicit trace: ZTraceElement): ZSink[Any, Any, Any, E, Nothing, Nothing]
Creates a sink halting with a specified cause.
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def fold[Err, In, S](z: S)(contFn: (S) => Boolean)(f: (S, In) => S)(implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, In, S]
A sink that folds its inputs with the provided function, termination predicate and initial state.
- def foldChunks[Err, In, S](z: S)(contFn: (S) => Boolean)(f: (S, Chunk[In]) => S)(implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, Nothing, S]
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.
contFncondition is checked only for the initial value and at the end of processing of each chunk.fandcontFnmust preserve chunking-invariance. - def foldChunksZIO[Env, Err, In, S](z: S)(contFn: (S) => Boolean)(f: (S, Chunk[In]) => ZIO[Env, Err, S])(implicit trace: ZTraceElement): ZSink[Env, Err, In, Err, In, S]
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.
contFncondition is checked only for the initial value and at the end of processing of each chunk.fandcontFnmust preserve chunking-invariance. - def foldLeft[Err, In, S](z: S)(f: (S, In) => S)(implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, Nothing, S]
A sink that folds its inputs with the provided function and initial state.
- def foldLeftChunks[Err, In, S](z: S)(f: (S, Chunk[In]) => S)(implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, Nothing, S]
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.
fmust preserve chunking-invariance. - def foldLeftChunksZIO[R, Err, In, S](z: S)(f: (S, Chunk[In]) => ZIO[R, Err, S])(implicit trace: ZTraceElement): ZSink[R, Err, In, Err, Nothing, S]
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.
fmust preserve chunking-invariance. - def foldLeftZIO[R, Err, In, S](z: S)(f: (S, In) => ZIO[R, Err, S])(implicit trace: ZTraceElement): ZSink[R, Err, In, Err, In, S]
A sink that effectfully folds its inputs with the provided function and initial state.
- def foldUntil[Err, In, S](z: S, max: Long)(f: (S, In) => S)(implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, In, S]
Creates a sink that folds elements of type
Ininto a structure of typeSuntilmaxelements have been folded.Creates a sink that folds elements of type
Ininto a structure of typeSuntilmaxelements have been folded.Like foldWeighted, but with a constant cost function of 1.
- def foldUntilZIO[Env, In, Err, S](z: S, max: Long)(f: (S, In) => ZIO[Env, Err, S])(implicit trace: ZTraceElement): ZSink[Env, Err, In, Err, In, S]
Creates a sink that effectfully folds elements of type
Ininto a structure of typeSuntilmaxelements have been folded.Creates a sink that effectfully folds elements of type
Ininto a structure of typeSuntilmaxelements have been folded.Like foldWeightedM, but with a constant cost function of 1.
- def foldWeighted[Err, In, S](z: S)(costFn: (S, In) => Long, max: Long)(f: (S, In) => S)(implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, In, S]
Creates a sink that folds elements of type
Ininto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.Creates a sink that folds elements of type
Ininto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.- Note
Elements that have an individual cost larger than
maxwill force the sink to cross themaxcost. See foldWeightedDecompose for a variant that can handle these cases.
- def foldWeightedDecompose[Err, In, S](z: S)(costFn: (S, In) => Long, max: Long, decompose: (In) => Chunk[In])(f: (S, In) => S)(implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, In, S]
Creates a sink that folds elements of type
Ininto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.Creates a sink that folds elements of type
Ininto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.The
decomposefunction will be used for decomposing elements that cause anSaggregate to crossmaxinto 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
decomposeyields 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
ZIOvalue, and consequently it allows the sink to fail. - def foldWeightedDecomposeZIO[Env, Err, In, S](z: S)(costFn: (S, In) => ZIO[Env, Err, Long], max: Long, decompose: (In) => ZIO[Env, Err, Chunk[In]])(f: (S, In) => ZIO[Env, Err, S])(implicit trace: ZTraceElement): ZSink[Env, Err, In, Err, In, S]
Creates a sink that effectfully folds elements of type
Ininto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.Creates a sink that effectfully folds elements of type
Ininto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.The
decomposefunction will be used for decomposing elements that cause anSaggregate to crossmaxinto smaller elements. Be vigilant with this function, it has to generate "simpler" values or the fold may never end. A value is considered indivisible ifdecomposeyields 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.
- def foldWeightedZIO[Env, Err, In, S](z: S)(costFn: (S, In) => ZIO[Env, Err, Long], max: Long)(f: (S, In) => ZIO[Env, Err, S])(implicit trace: ZTraceElement): ZSink[Env, Err, In, Err, In, S]
Creates a sink that effectfully folds elements of type
Ininto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.Creates a sink that effectfully folds elements of type
Ininto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.- Note
Elements that have an individual cost larger than
maxwill force the sink to cross themaxcost. See foldWeightedDecomposeM for a variant that can handle these cases.
- def foldZIO[Env, Err, In, S](z: S)(contFn: (S) => Boolean)(f: (S, In) => ZIO[Env, Err, S])(implicit trace: ZTraceElement): ZSink[Env, Err, In, Err, In, S]
A sink that effectfully folds its inputs with the provided function, termination predicate and initial state.
- def foreach[R, Err, In](f: (In) => ZIO[R, Err, Any])(implicit trace: ZTraceElement): ZSink[R, Err, In, Err, In, Unit]
A sink that executes the provided effectful function for every element fed to it.
- def foreachChunk[R, Err, In](f: (Chunk[In]) => ZIO[R, Err, Any])(implicit trace: ZTraceElement): ZSink[R, Err, In, Err, In, Unit]
A sink that executes the provided effectful function for every chunk fed to it.
- def foreachChunkWhile[R, Err, In](f: (Chunk[In]) => ZIO[R, Err, Boolean])(implicit trace: ZTraceElement): ZSink[R, Err, In, Err, In, Unit]
A sink that executes the provided effectful function for every chunk fed to it until
fevaluates tofalse. - final def foreachWhile[R, Err, In](f: (In) => ZIO[R, Err, Boolean])(implicit trace: ZTraceElement): ZSink[R, Err, In, Err, In, Unit]
A sink that executes the provided effectful function for every element fed to it until
fevaluates tofalse. - def fromZIO[R, E, Z](b: => ZIO[R, E, Z])(implicit trace: ZTraceElement): ZSink[R, Any, Any, E, Nothing, Z]
Creates a single-value sink produced from an effect
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def head[Err, In](implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, In, Option[In]]
Creates a sink containing the first value.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def iso_8859_1Decode(implicit trace: ZTraceElement): ZSink[Any, Nothing, Byte, Nothing, Nothing, Option[String]]
- def last[Err, In](implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, In, Option[In]]
Creates a sink containing the last value.
- def leftover[L](c: Chunk[L])(implicit trace: ZTraceElement): ZSink[Any, Any, Any, Nothing, L, Unit]
- def mkString[Err](implicit trace: ZTraceElement): ZSink[Any, Err, Any, Err, Nothing, String]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def never(implicit trace: ZTraceElement): ZSink[Any, Any, Any, Nothing, Nothing, Nothing]
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def succeed[Z](z: => Z)(implicit trace: ZTraceElement): ZSink[Any, Any, Any, Nothing, Nothing, Z]
A sink that immediately ends with the specified value.
- def sum[Err, A](implicit A: Numeric[A], trace: ZTraceElement): ZSink[Any, Err, A, Err, Nothing, A]
A sink that sums incoming numeric values.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def take[Err, In](n: Int)(implicit trace: ZTraceElement): ZSink[Any, Err, In, Err, In, Chunk[In]]
A sink that takes the specified number of values.
- def timed[Err](implicit trace: ZTraceElement): ZSink[Has[Clock], Err, Any, Err, Nothing, zio.Duration]
- def toString(): String
- Definition Classes
- AnyRef → Any
- def unwrap[R, InErr, In, OutErr, L, Z](zio: ZIO[R, OutErr, ZSink[R, InErr, In, OutErr, L, Z]])(implicit trace: ZTraceElement): ZSink[R, InErr, In, OutErr, L, Z]
Creates a sink produced from an effect.
- def unwrapManaged[R, InErr, In, OutErr, L, Z](managed: ZManaged[R, OutErr, ZSink[R, InErr, In, OutErr, L, Z]])(implicit trace: ZTraceElement): ZSink[R, InErr, In, OutErr, L, Z]
Creates a sink produced from a managed effect.
- def usASCIIDecode[Err](implicit trace: ZTraceElement): ZSink[Any, Err, Byte, Err, Nothing, Option[String]]
- def utf16BEDecode[Err](implicit trace: ZTraceElement): ZSink[Any, Err, Byte, Err, Byte, Option[String]]
- def utf16Decode[Err](implicit trace: ZTraceElement): ZSink[Any, Err, Byte, Err, Byte, Option[String]]
- def utf16LEDecode[Err](implicit trace: ZTraceElement): ZSink[Any, Err, Byte, Err, Byte, Option[String]]
- def utf32BEDecode[Err](implicit trace: ZTraceElement): ZSink[Any, Err, Byte, Err, Byte, Option[String]]
- def utf32Decode[Err](implicit trace: ZTraceElement): ZSink[Any, Err, Byte, Err, Byte, Option[String]]
- def utf32LEDecode[Err](implicit trace: ZTraceElement): ZSink[Any, Err, Byte, Err, Byte, Option[String]]
- def utf8Decode[Err](implicit trace: ZTraceElement): ZSink[Any, Err, Byte, Err, Byte, Option[String]]
- def utfDecode[Err](implicit trace: ZTraceElement): ZSink[Any, Err, Byte, Err, Byte, Option[String]]
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Deprecated Value Members
- def collectAllWhileM[Env, Err, In](p: (In) => ZIO[Env, Err, Boolean])(implicit trace: ZTraceElement): ZSink[Env, Err, In, Err, In, Chunk[In]]
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.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use collectAllWhileZIO
- def dropWhileM[R, InErr, In](p: (In) => ZIO[R, InErr, Boolean])(implicit trace: ZTraceElement): ZSink[R, InErr, In, InErr, In, Any]
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use dropWhileZIO
- def foldChunksM[Env, Err, In, S](z: S)(contFn: (S) => Boolean)(f: (S, Chunk[In]) => ZIO[Env, Err, S])(implicit trace: ZTraceElement): ZSink[Env, Err, In, Err, In, S]
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.
contFncondition is checked only for the initial value and at the end of processing of each chunk.fandcontFnmust preserve chunking-invariance.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foldChunksZIO
- def foldLeftChunksM[R, Err, In, S](z: S)(f: (S, Chunk[In]) => ZIO[R, Err, S])(implicit trace: ZTraceElement): ZSink[R, Err, In, Err, Nothing, S]
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.
fmust preserve chunking-invariance.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foldLeftChunksZIO
- def foldLeftM[R, Err, In, S](z: S)(f: (S, In) => ZIO[R, Err, S])(implicit trace: ZTraceElement): ZSink[R, Err, In, Err, In, 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.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foldLeftZIO
- def foldM[Env, Err, In, S](z: S)(contFn: (S) => Boolean)(f: (S, In) => ZIO[Env, Err, S])(implicit trace: ZTraceElement): ZSink[Env, Err, In, Err, In, 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.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foldZIO
- def foldUntilM[Env, In, Err, S](z: S, max: Long)(f: (S, In) => ZIO[Env, Err, S])(implicit trace: ZTraceElement): ZSink[Env, Err, In, Err, In, S]
Creates a sink that effectfully folds elements of type
Ininto a structure of typeSuntilmaxelements have been folded.Creates a sink that effectfully folds elements of type
Ininto a structure of typeSuntilmaxelements have been folded.Like foldWeightedM, but with a constant cost function of 1.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foldUntilZIO
- def foldWeightedDecomposeM[Env, Err, In, S](z: S)(costFn: (S, In) => ZIO[Env, Err, Long], max: Long, decompose: (In) => ZIO[Env, Err, Chunk[In]])(f: (S, In) => ZIO[Env, Err, S])(implicit trace: ZTraceElement): ZSink[Env, Err, In, Err, In, S]
Creates a sink that effectfully folds elements of type
Ininto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.Creates a sink that effectfully folds elements of type
Ininto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.The
decomposefunction will be used for decomposing elements that cause anSaggregate to crossmaxinto smaller elements. Be vigilant with this function, it has to generate "simpler" values or the fold may never end. A value is considered indivisible ifdecomposeyields 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.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use foldWeightedDecomposeZIO
- def foldWeightedM[Env, Err, In, S](z: S)(costFn: (S, In) => ZIO[Env, Err, Long], max: Long)(f: (S, In) => ZIO[Env, Err, S])(implicit trace: ZTraceElement): ZSink[Env, Err, In, Err, In, S]
Creates a sink that effectfully folds elements of type
Ininto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.Creates a sink that effectfully folds elements of type
Ininto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0-) use foldWeightedZIO
- Note
Elements that have an individual cost larger than
maxwill force the sink to cross themaxcost. See foldWeightedDecomposeM for a variant that can handle these cases.
- def fromEffect[R, E, Z](b: => ZIO[R, E, Z])(implicit trace: ZTraceElement): ZSink[R, Any, Any, E, Nothing, Z]
Creates a single-value sink produced from an effect
Creates a single-value sink produced from an effect
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use fromZIO
- def halt[E](e: => Cause[E])(implicit trace: ZTraceElement): ZSink[Any, Any, Any, E, Nothing, Nothing]
Creates a sink halting with a specified cause.
Creates a sink halting with a specified cause.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use failCause
- def managed[R, InErr, In, OutErr >: InErr, A, L <: In, Z](resource: ZManaged[R, OutErr, A])(fn: (A) => ZSink[R, InErr, In, OutErr, L, Z])(implicit trace: ZTraceElement): ZSink[R, InErr, In, OutErr, In, Z]
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) use unwrapManaged