Object/Class

zio.stream.experimental

ZSink

Related Docs: class ZSink | package experimental

Permalink

object ZSink

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ZSink
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final class AccessSinkPartiallyApplied[R] extends AnyVal

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def accessSink[R]: AccessSinkPartiallyApplied[R]

    Permalink

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

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def collectAll[Err, In]: ZSink[Any, Err, In, Err, Nothing, Chunk[In]]

    Permalink
  8. def collectAllN[Err, In](n: Int): ZSink[Any, Err, In, Err, In, Chunk[In]]

    Permalink

    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.

  9. def collectAllToMap[Err, In, K](key: (In) ⇒ K)(f: (In, In) ⇒ In): ZSink[Any, Err, In, Err, Nothing, Map[K, In]]

    Permalink

    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.

  10. def collectAllToMapN[Err, In, K](n: Long)(key: (In) ⇒ K)(f: (In, In) ⇒ In): ZSink[Any, Err, In, Err, In, Map[K, In]]

    Permalink

    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.

  11. def collectAllToSet[Err, In]: ZSink[Any, Err, In, Err, Nothing, Set[In]]

    Permalink

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

  12. def collectAllToSetN[Err, In](n: Long): ZSink[Any, Err, In, Err, In, Set[In]]

    Permalink

    A sink that collects first n distinct inputs into a set.

  13. def collectAllWhile[Err, In](p: (In) ⇒ Boolean): ZSink[Any, Err, In, Err, In, Chunk[In]]

    Permalink

    Accumulates incoming elements into a chunk as long as they verify predicate p.

  14. def collectAllWhileZIO[Env, Err, In](p: (In) ⇒ ZIO[Env, Err, Boolean]): ZSink[Env, Err, In, Err, In, Chunk[In]]

    Permalink

    Accumulates incoming elements into a chunk as long as they verify effectful predicate p.

  15. def count[Err]: ZSink[Any, Err, Any, Err, Nothing, Long]

    Permalink

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

  16. def die(e: ⇒ Throwable): ZSink[Any, Any, Any, Nothing, Nothing, Nothing]

    Permalink

    Creates a sink halting with the specified Throwable.

  17. def dieMessage(m: ⇒ String): ZSink[Any, Any, Any, Nothing, Nothing, Nothing]

    Permalink

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

  18. def drain[Err]: ZSink[Any, Err, Any, Err, Nothing, Unit]

    Permalink

    A sink that ignores its inputs.

  19. def effectSuspendTotal[Env, InErr, In, OutErr, Leftover, Done](sink: ⇒ ZSink[Env, InErr, In, OutErr, Leftover, Done]): ZSink[Env, InErr, In, OutErr, Leftover, Done]

    Permalink

    Returns a lazily constructed sink that may require effects for its creation.

  20. def effectTotal[A](a: ⇒ A): ZSink[Any, Any, Any, Nothing, Nothing, A]

    Permalink

    Returns a sink that executes a total effect and ends with its result.

  21. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  23. def fail[E](e: ⇒ E): ZSink[Any, Any, Any, E, Nothing, Nothing]

    Permalink

    A sink that always fails with the specified error.

  24. def failCause[E](e: ⇒ Cause[E]): ZSink[Any, Any, Any, E, Nothing, Nothing]

    Permalink

    Creates a sink halting with a specified cause.

  25. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  26. def fold[Err, In, S](z: S)(contFn: (S) ⇒ Boolean)(f: (S, In) ⇒ S): ZSink[Any, Err, In, Err, In, S]

    Permalink

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

  27. def foldChunks[Err, In, S](z: S)(contFn: (S) ⇒ Boolean)(f: (S, Chunk[In]) ⇒ S): ZSink[Any, Err, In, Err, Nothing, S]

    Permalink

    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.

  28. def foldChunksZIO[Env, Err, In, S](z: S)(contFn: (S) ⇒ Boolean)(f: (S, Chunk[In]) ⇒ ZIO[Env, Err, S]): ZSink[Env, Err, In, Err, In, S]

    Permalink

    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.

  29. def foldLeft[Err, In, S](z: S)(f: (S, In) ⇒ S): ZSink[Any, Err, In, Err, Nothing, S]

    Permalink

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

  30. def foldLeftChunks[Err, In, S](z: S)(f: (S, Chunk[In]) ⇒ S): ZSink[Any, Err, In, Err, Nothing, S]

    Permalink

    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.

  31. def foldLeftChunksZIO[R, Err, In, S](z: S)(f: (S, Chunk[In]) ⇒ ZIO[R, Err, S]): ZSink[R, Err, In, Err, Nothing, S]

    Permalink

    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.

  32. def foldLeftZIO[R, Err, In, S](z: S)(f: (S, In) ⇒ ZIO[R, Err, S]): ZSink[R, Err, In, Err, In, S]

    Permalink

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

  33. def foldUntil[Err, In, S](z: S, max: Long)(f: (S, In) ⇒ S): ZSink[Any, Err, In, Err, In, S]

    Permalink

    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.

  34. def foldUntilZIO[Env, In, Err, S](z: S, max: Long)(f: (S, In) ⇒ ZIO[Env, Err, S]): ZSink[Env, Err, In, Err, In, S]

    Permalink

    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.

  35. def foldWeighted[Err, In, S](z: S)(costFn: (S, In) ⇒ Long, max: Long)(f: (S, In) ⇒ S): ZSink[Any, Err, In, Err, In, S]

    Permalink

    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.

    Note

    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.

  36. def foldWeightedDecompose[Err, In, S](z: S)(costFn: (S, In) ⇒ Long, max: Long, decompose: (In) ⇒ Chunk[In])(f: (S, In) ⇒ S): ZSink[Any, Err, In, Err, In, S]

    Permalink

    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.

  37. 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]): ZSink[Env, Err, In, Err, In, S]

    Permalink

    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.

  38. def foldWeightedZIO[Env, Err, In, S](z: S)(costFn: (S, In) ⇒ ZIO[Env, Err, Long], max: Long)(f: (S, In) ⇒ ZIO[Env, Err, S]): ZSink[Env, Err, In, Err, In, S]

    Permalink

    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.

    Note

    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.

  39. def foldZIO[Env, Err, In, S](z: S)(contFn: (S) ⇒ Boolean)(f: (S, In) ⇒ ZIO[Env, Err, S]): ZSink[Env, Err, In, Err, In, S]

    Permalink

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

  40. def foreach[R, Err, In](f: (In) ⇒ ZIO[R, Err, Any]): ZSink[R, Err, In, Err, In, Unit]

    Permalink

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

  41. def foreachChunk[R, Err, In](f: (Chunk[In]) ⇒ ZIO[R, Err, Any]): ZSink[R, Err, In, Err, In, Unit]

    Permalink

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

  42. def foreachChunkWhile[R, Err, In](f: (Chunk[In]) ⇒ ZIO[R, Err, Boolean]): ZSink[R, Err, In, Err, In, Unit]

    Permalink

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

  43. final def foreachWhile[R, Err, In](f: (In) ⇒ ZIO[R, Err, Boolean]): ZSink[R, Err, In, Err, In, Unit]

    Permalink

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

  44. def fromZIO[R, E, Z](b: ⇒ ZIO[R, E, Z]): ZSink[R, Any, Any, E, Nothing, Z]

    Permalink

    Creates a single-value sink produced from an effect

  45. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  46. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  47. def head[Err, In]: ZSink[Any, Err, In, Err, In, Option[In]]

    Permalink

    Creates a sink containing the first value.

  48. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  49. def last[Err, In]: ZSink[Any, Err, In, Err, In, Option[In]]

    Permalink

    Creates a sink containing the last value.

  50. def leftover[L](c: Chunk[L]): ZSink[Any, Any, Any, Nothing, L, Unit]

    Permalink
  51. 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]): ZSink[R, InErr, In, OutErr, In, Z]

    Permalink
  52. def mkString[Err]: ZSink[Any, Err, Any, Err, Nothing, String]

    Permalink
  53. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  54. val never: ZSink[Any, Any, Any, Nothing, Nothing, Nothing]

    Permalink
  55. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  56. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  57. def succeed[Z](z: ⇒ Z): ZSink[Any, Any, Any, Nothing, Nothing, Z]

    Permalink

    A sink that immediately ends with the specified value.

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

    Permalink

    A sink that sums incoming numeric values.

  59. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  60. def take[Err, In](n: Int): ZSink[Any, Err, In, Err, In, Chunk[In]]

    Permalink

    A sink that takes the specified number of values.

  61. def timed[Err]: ZSink[Has[Clock], Err, Any, Err, Nothing, zio.Duration]

    Permalink
  62. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  63. def utf8Decode[Err]: ZSink[Any, Err, Byte, Err, Byte, Option[String]]

    Permalink
  64. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  65. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  66. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def collectAllWhileM[Env, Err, In](p: (In) ⇒ ZIO[Env, Err, Boolean]): ZSink[Env, Err, In, Err, In, Chunk[In]]

    Permalink

    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

  2. def foldChunksM[Env, Err, In, S](z: S)(contFn: (S) ⇒ Boolean)(f: (S, Chunk[In]) ⇒ ZIO[Env, Err, S]): ZSink[Env, Err, In, Err, In, S]

    Permalink

    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.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use foldChunksZIO

  3. def foldLeftChunksM[R, Err, In, S](z: S)(f: (S, Chunk[In]) ⇒ ZIO[R, Err, S]): ZSink[R, Err, In, Err, Nothing, S]

    Permalink

    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.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use foldLeftChunksZIO

  4. def foldLeftM[R, Err, In, S](z: S)(f: (S, In) ⇒ ZIO[R, Err, S]): ZSink[R, Err, In, Err, In, S]

    Permalink

    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

  5. def foldM[Env, Err, In, S](z: S)(contFn: (S) ⇒ Boolean)(f: (S, In) ⇒ ZIO[Env, Err, S]): ZSink[Env, Err, In, Err, In, S]

    Permalink

    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

  6. def foldUntilM[Env, In, Err, S](z: S, max: Long)(f: (S, In) ⇒ ZIO[Env, Err, S]): ZSink[Env, Err, In, Err, In, S]

    Permalink

    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.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use foldUntilZIO

  7. 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]): ZSink[Env, Err, In, Err, In, S]

    Permalink

    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.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) use foldWeightedDecomposeZIO

  8. def foldWeightedM[Env, Err, In, S](z: S)(costFn: (S, In) ⇒ ZIO[Env, Err, Long], max: Long)(f: (S, In) ⇒ ZIO[Env, Err, S]): ZSink[Env, Err, In, Err, In, S]

    Permalink

    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.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0-) use foldWeightedZIO

    Note

    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.

  9. def fromEffect[R, E, Z](b: ⇒ ZIO[R, E, Z]): ZSink[R, Any, Any, E, Nothing, Z]

    Permalink

    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

  10. def halt[E](e: ⇒ Cause[E]): ZSink[Any, Any, Any, E, Nothing, Nothing]

    Permalink

    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

Inherited from AnyRef

Inherited from Any

Ungrouped