FoldAsync op for Flow #18603
This commit is contained in:
parent
9630feb6cc
commit
efc87af58a
16 changed files with 519 additions and 620 deletions
|
|
@ -786,6 +786,27 @@ trait FlowOps[+Out, +Mat] {
|
|||
*/
|
||||
def fold[T](zero: T)(f: (T, Out) ⇒ T): Repr[T] = via(Fold(zero, f))
|
||||
|
||||
/**
|
||||
* Similar to `fold` but with an asynchronous function.
|
||||
* Applies the given function towards its current and next value,
|
||||
* yielding the next current value.
|
||||
*
|
||||
* If the function `f` returns a failure and the supervision decision is
|
||||
* [[akka.stream.Supervision.Restart]] current value starts at `zero` again
|
||||
* the stream will continue.
|
||||
*
|
||||
* '''Emits when''' upstream completes
|
||||
*
|
||||
* '''Backpressures when''' downstream backpressures
|
||||
*
|
||||
* '''Completes when''' upstream completes
|
||||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*
|
||||
* See also [[FlowOps.fold]]
|
||||
*/
|
||||
def foldAsync[T](zero: T)(f: (T, Out) ⇒ Future[T]): Repr[T] = via(new FoldAsync(zero, f))
|
||||
|
||||
/**
|
||||
* Similar to `fold` but uses first element as zero element.
|
||||
* Applies the given function towards its current and next value,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue