Computes a promised value B from the state of the Iteratee.
Computes a promised value B from the state of the Iteratee.
Note that the state of the Iteratee may be computed asynchronously,
so the folder function may run asynchronously in another thread,
but is not guaranteed to do so. Exceptions thrown by the folder function
may be stored in the returned Promise or may be thrown from fold()
.
If the folder function itself is synchronous, it's better to
use pureFold()
instead of fold()
.
Sends one element of input to the Iteratee and returns a promise containing the new Iteratee.
Sends one element of input to the Iteratee and returns a promise containing the new Iteratee. The promise may or may not be completed already when it's returned (the iteratee may use an asynchronous operation to handle the input).
input being sent
On Done of this Iteratee, the result is passed to the provided function, and the resulting Iteratee is used to continue consuming input
On Done of this Iteratee, the result is passed to the provided function, and the resulting Iteratee is used to continue consuming input
If the resulting Iteratee of evaluating the f function is a Done then its left Input is ignored and its computed result is wrapped in a Done and returned
Like flatMap but allows the flatMap function to execute asynchronously.
Like flatMap but allows the flatMap function to execute asynchronously.
This is particularly useful if you want to do blocking operations, so that you can ensure that those operations execute in the right execution context, rather than the iteratee execution context, which would potentially block all other iteratee operations.
Like flatMap except that it concatenates left over inputs if the Iteratee returned by evaluating f is a Done.
This method provides the means to check on the state of the Iteratee and eventually extract a value in a Promise
This method provides the means to check on the state of the Iteratee and eventually extract a value in a Promise
a function that will be called if the Iteratee is a Done
a function that will be called if the Iteratee is a Cont
a function that will be called if the Iteratee is an Error
a scala.concurrent.Future of a value extracted by calling the appropriate provided function
Uses the provided function to transform the Iteratee's computed result when the Iteratee is done.
Uses the provided function to transform the Iteratee's computed result when the Iteratee is done.
a function for tranforming the computed result
Like map but allows the map function to execute asynchronously.
Like map but allows the map function to execute asynchronously.
This is particularly useful if you want to do blocking operations, so that you can ensure that those operations execute in the right execution context, rather than the iteratee execution context, which would potentially block all other iteratee operations.
Like pureFold, except taking functions that return an Iteratee
Like pureFold, except taking functions that return an Iteratee
an Iteratee extracted by calling the appropriate provided function
Like fold but taking functions returning pure values (not in promises)
Like fold but taking functions returning pure values (not in promises)
a scala.concurrent.Future of a value extracted by calling the appropriate provided function
Extracts the computed result of the Iteratee pushing an Input.
Extracts the computed result of the Iteratee pushing an Input.EOF if necessary Extracts the computed result of the Iteratee, pushing an Input.EOF first if the Iteratee is in the play.api.libs.iteratee.Cont state. In case of error, an exception may be thrown synchronously or may be used to complete the returned Promise; this indeterminate behavior is inherited from fold().
a scala.concurrent.Future of the eventually computed result
Converts the Iteratee into a Promise containing its state.
An Iteratee consumes a stream of elements of type E, producing a result of type A. The stream itself is represented by the Input trait. An Iteratee is an immutable data type, so each step in consuming the stream generates a new Iteratee with a new state.
At a high level, an Iteratee is just a function that takes a piece of input and returns either a final result or a new function that takes another piece of input. To represent this, an Iteratee can be in one of three states (see the play.api.libs.iteratee.Step trait): play.api.libs.iteratee.Done, which means it contains a result and potentially some unconsumed part of the stream; play.api.libs.iteratee.Cont, which means it contains a function to be invoked to generate a new Iteratee from the next piece of input; play.api.libs.iteratee.Error, which means it contains an error message and potentially some unconsumed part of the stream.
One would expect to transform an Iteratee through the Cont state N times, eventually arriving at either the Done or Error state.
Typically an play.api.libs.iteratee.Enumerator would be used to push data into an Iteratee by invoking the function in the play.api.libs.iteratee.Cont state until either 1) the iteratee leaves the Cont state or 2) the enumerator runs out of data.
The Iteratee does not do any resource management (such as closing streams); the producer pushing stuff into the Iteratee has that responsibility.+ * The state of an Iteratee (the current play.api.libs.iteratee.Step may not be available synchronously; it may be pending an asynchronous computation. This is the difference between Iteratee and Step.
Input type
Result type of this Iteratee