| SourceUnfoldAsyncTState, TElem Method |
Namespace:
Akka.Streams.Dsl
Assembly:
Akka.Streams (in Akka.Streams.dll) Version: 1.2.3.129 (1.2.3.129)
Syntax public static Source<TElem, NotUsed> UnfoldAsync<TState, TElem>(
TState state,
Func<TState, Task<Tuple<TState, TElem>>> unfoldAsync
)
static member UnfoldAsync :
state : 'TState *
unfoldAsync : Func<'TState, Task<Tuple<'TState, 'TElem>>> -> Source<'TElem, NotUsed>
Parameters
- state
- Type: TState
TBD - unfoldAsync
- Type: SystemFuncTState, TaskTupleTState, TElem
TBD
Type Parameters
- TState
- TBD
- TElem
- TBD
Return Value
Type:
SourceTElem,
NotUsedTBD
Examples
For example, all the Fibonacci numbers under 10M:
Source.unfoldAsync(0 → 1) {
case (a, _) if a > 10000000 ⇒ Future.successful(None)
case (a, b) ⇒ Future{
Thread.sleep(1000)
Some((b → (a + b)) → a)
}
}
See Also