object ZTransducer
- Alphabetic
- By Inheritance
- ZTransducer
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
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
apply[I]: ZTransducer[Any, Nothing, I, I]
Shorthand form for ZTransducer.identity.
Shorthand form for ZTransducer.identity. Use as:
ZTransducer[Int].filter(_ % 2 != 0)
- def apply[R, E, I, O](push: ZManaged[R, Nothing, (Option[Chunk[I]]) ⇒ ZIO[R, E, Chunk[O]]]): ZTransducer[R, E, I, O]
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
collectAllN[I](n: Long): ZTransducer[Any, Nothing, I, List[I]]
Creates a transducer accumulating incoming values into lists of maximum size
n
. -
def
collectAllToMapN[K, I](n: Long)(key: (I) ⇒ K)(f: (I, I) ⇒ I): ZTransducer[Any, Nothing, I, Map[K, I]]
Creates a transducer accumulating incoming values into maps of up to
n
keys.Creates a transducer accumulating incoming values into maps of up to
n
keys. Elements are mapped to keys using the functionkey
; elements mapped to the same key will be merged with the functionf
. -
def
collectAllToSetN[I](n: Long): ZTransducer[Any, Nothing, I, Set[I]]
Creates a transducer accumulating incoming values into sets of maximum size
n
. -
def
collectAllWhile[I](p: (I) ⇒ Boolean): ZTransducer[Any, Nothing, I, List[I]]
Accumulates incoming elements into a list as long as they verify predicate
p
. -
def
collectAllWhileM[R, E, I](p: (I) ⇒ ZIO[R, E, Boolean]): ZTransducer[R, E, I, List[I]]
Accumulates incoming elements into a list as long as they verify effectful predicate
p
. -
def
die(e: ⇒ Throwable): ZTransducer[Any, Nothing, Any, Nothing]
Creates a transducer that always dies with the specified exception.
-
def
dropWhile[I](p: (I) ⇒ Boolean): ZTransducer[Any, Nothing, I, I]
Creates a transducer that starts consuming values as soon as one fails the predicate
p
. -
def
dropWhileM[R, E, I](p: (I) ⇒ ZIO[R, E, Boolean]): ZTransducer[R, E, I, I]
Creates a transducer that starts consuming values as soon as one fails the effectful predicate
p
. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
fail[E](e: ⇒ E): ZTransducer[Any, E, Any, Nothing]
Creates a transducer that always fails with the specified failure.
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
fold[I, O](z: O)(contFn: (O) ⇒ Boolean)(f: (O, I) ⇒ O): ZTransducer[Any, Nothing, I, O]
Creates a transducer by folding over a structure of type
O
for as long ascontFn
results intrue
.Creates a transducer by folding over a structure of type
O
for as long ascontFn
results intrue
. The transducer will emit a value whencontFn
evaluates tofalse
and then restart the folding. -
def
foldLeft[I, O](z: O)(f: (O, I) ⇒ O): ZTransducer[Any, Nothing, I, O]
Creates a transducer by folding over a structure of type
O
.Creates a transducer by folding over a structure of type
O
. The transducer will fold the inputs until the stream ends, resulting in a stream with one element. -
def
foldLeftM[R, E, I, O](z: O)(f: (O, I) ⇒ ZIO[R, E, O]): ZTransducer[R, E, I, O]
Creates a transducer by effectfully folding over a structure of type
O
.Creates a transducer by effectfully folding over a structure of type
O
. The transducer will fold the inputs until the stream ends, resulting in a stream with one element. -
def
foldM[R, E, I, O](z: O)(contFn: (O) ⇒ Boolean)(f: (O, I) ⇒ ZIO[R, E, O]): ZTransducer[R, E, I, O]
Creates a sink by effectfully folding over a structure of type
S
. -
def
foldUntil[I, O](z: O, max: Long)(f: (O, I) ⇒ O): ZTransducer[Any, Nothing, I, O]
Creates a transducer that folds elements of type
I
into a structure of typeO
untilmax
elements have been folded.Creates a transducer that folds elements of type
I
into a structure of typeO
untilmax
elements have been folded.Like foldWeighted, but with a constant cost function of 1.
-
def
foldUntilM[R, E, I, O](z: O, max: Long)(f: (O, I) ⇒ ZIO[R, E, O]): ZTransducer[R, E, I, O]
Creates a transducer that effectfully folds elements of type
I
into a structure of typeO
untilmax
elements have been folded.Creates a transducer that effectfully folds elements of type
I
into a structure of typeO
untilmax
elements have been folded.Like foldWeightedM, but with a constant cost function of 1.
-
def
foldWeighted[I, O](z: O)(costFn: (O, I) ⇒ Long, max: Long)(f: (O, I) ⇒ O): ZTransducer[Any, Nothing, I, O]
Creates a transducer that folds elements of type
I
into a structure of typeO
, untilmax
worth of elements (determined by thecostFn
) have been folded.Creates a transducer that folds elements of type
I
into a structure of typeO
, untilmax
worth of elements (determined by thecostFn
) have been folded.- Note
Elements that have an individual cost larger than
max
will force the transducer to cross themax
cost. See foldWeightedDecompose for a variant that can handle these cases.
-
def
foldWeightedDecompose[I, O](z: O)(costFn: (O, I) ⇒ Long, max: Long, decompose: (I) ⇒ Chunk[I])(f: (O, I) ⇒ O): ZTransducer[Any, Nothing, I, O]
Creates a transducer that folds elements of type
I
into a structure of typeO
, untilmax
worth of elements (determined by thecostFn
) have been folded.Creates a transducer that folds elements of type
I
into a structure of typeO
, untilmax
worth of elements (determined by thecostFn
) have been folded.The
decompose
function will be used for decomposing elements that cause anO
aggregate to crossmax
into smaller elements. For example:Stream(1, 5, 1) .aggregate( ZTransducer .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 transducer to fail. -
def
foldWeightedDecomposeM[R, E, I, O](z: O)(costFn: (O, I) ⇒ ZIO[R, E, Long], max: Long, decompose: (I) ⇒ ZIO[R, E, Chunk[I]])(f: (O, I) ⇒ ZIO[R, E, O]): ZTransducer[R, E, I, O]
Creates a transducer that effectfully folds elements of type
I
into a structure of typeS
, untilmax
worth of elements (determined by thecostFn
) have been folded.Creates a transducer that effectfully folds elements of type
I
into a structure of typeS
, untilmax
worth of elements (determined by thecostFn
) have been folded.The
decompose
function will be used for decomposing elements that cause anS
aggregate to crossmax
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 ifdecompose
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.
-
def
foldWeightedM[R, E, I, O](z: O)(costFn: (O, I) ⇒ ZIO[R, E, Long], max: Long)(f: (O, I) ⇒ ZIO[R, E, O]): ZTransducer[R, E, I, O]
Creates a transducer that effectfully folds elements of type
I
into a structure of typeS
, untilmax
worth of elements (determined by thecostFn
) have been folded.Creates a transducer that effectfully folds elements of type
I
into a structure of typeS
, untilmax
worth of elements (determined by thecostFn
) have been folded.- Note
Elements that have an individual cost larger than
max
will force the transducer to cross themax
cost. See foldWeightedDecomposeM for a variant that can handle these cases.
-
def
fromEffect[R, E, A](zio: ZIO[R, E, A]): ZTransducer[R, E, Any, A]
Creates a transducer that always evaluates the specified effect.
-
def
fromFunction[I, O](f: (I) ⇒ O): ZTransducer[Any, Unit, I, O]
Creates a transducer that purely transforms incoming values.
-
def
fromFunctionM[R, E, I, O](f: (I) ⇒ ZIO[R, E, O]): ZTransducer[R, E, I, O]
Creates a transducer that effectfully transforms incoming values.
-
def
fromPush[R, E, I, O](push: (Option[Chunk[I]]) ⇒ ZIO[R, E, Chunk[O]]): ZTransducer[R, E, I, O]
Creates a transducer from a chunk processing function.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
head[O]: ZTransducer[Any, Nothing, O, Option[O]]
Creates a transducer that returns the first element of the stream, if it exists.
-
def
identity[I]: ZTransducer[Any, Nothing, I, I]
The identity transducer.
The identity transducer. Passed elements through.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
last[O]: ZTransducer[Any, Nothing, O, Option[O]]
Creates a transducer that returns the last element of the stream, if it exists.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
val
splitLines: ZTransducer[Any, Nothing, String, String]
Splits strings on newlines.
Splits strings on newlines. Handles both Windows newlines (
\r\n
) and UNIX newlines (\n
). -
def
splitOn(delimiter: String): ZTransducer[Any, Nothing, String, String]
Splits strings on a delimiter.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
val
utf8Decode: ZTransducer[Any, Nothing, Byte, String]
Decodes chunks of UTF-8 bytes into strings.
Decodes chunks of UTF-8 bytes into strings.
This transducer uses the String constructor's behavior when handling malformed byte sequences.
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- object Push