| SourceUnfoldTState, TElem Method |
Create a
SourceTOut, TMat that will unfold a value of type
TState into
a pair of the next state
TState and output elements of type
TElem.
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> Unfold<TState, TElem>(
TState state,
Func<TState, Tuple<TState, TElem>> unfold
)
static member Unfold :
state : 'TState *
unfold : Func<'TState, Tuple<'TState, 'TElem>> -> Source<'TElem, NotUsed>
Parameters
- state
- Type: TState
TBD - unfold
- Type: SystemFuncTState, TupleTState, TElem
TBD
Type Parameters
- TState
- TBD
- TElem
- TBD
Return Value
Type:
SourceTElem,
NotUsedTBD
Examples
For example, all the Fibonacci numbers under 10M:
Source.unfold(0 → 1) {
case (a, _) if a > 10000000 ⇒ None
case (a, b) ⇒ Some((b → (a + b)) → a)
}
See Also