-str - Removes Source.unfoldInf
Motivation: Since it can be easily implemented inline on top of unfold
This commit is contained in:
parent
22ccbcea39
commit
d65efc35c7
6 changed files with 18 additions and 37 deletions
|
|
@ -260,7 +260,7 @@ object Source {
|
|||
* }}}
|
||||
*/
|
||||
def unfold[S, E](s: S)(f: S ⇒ Option[(S, E)]): Source[E, Unit] =
|
||||
Source.fromGraph(new Unfold(s, f)).withAttributes(DefaultAttributes.unfold)
|
||||
Source.fromGraph(new Unfold(s, f))
|
||||
|
||||
/**
|
||||
* Same as [[unfold]], but uses an async function to generate the next state-element tuple.
|
||||
|
|
@ -278,19 +278,7 @@ object Source {
|
|||
* }}}
|
||||
*/
|
||||
def unfoldAsync[S, E](s: S)(f: S ⇒ Future[Option[(S, E)]]): Source[E, Unit] =
|
||||
Source.fromGraph(new UnfoldAsync(s, f)).withAttributes(DefaultAttributes.unfoldAsync)
|
||||
|
||||
/**
|
||||
* Simpler [[unfold]], for infinite sequences.
|
||||
*
|
||||
* {{{
|
||||
* Source.unfoldInf(0 → 1) {
|
||||
* case (a, b) ⇒ (b → (a + b)) → a
|
||||
* }
|
||||
* }}}
|
||||
*/
|
||||
def unfoldInf[S, E](s: S)(f: S ⇒ (S, E)): Source[E, Unit] =
|
||||
unfold(s)(s ⇒ Some(f(s))).withAttributes(DefaultAttributes.unfoldInf)
|
||||
Source.fromGraph(new UnfoldAsync(s, f))
|
||||
|
||||
/**
|
||||
* A `Source` with no elements, i.e. an empty stream that is completed immediately for every connected `Sink`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue