Merge pull request #19165 from hochgi/hochgi-unfold-docs-fixes

=str fixing documentation for PR #19143
This commit is contained in:
Konrad Malawski 2015-12-14 11:36:42 +00:00
commit 08d0f2290d
2 changed files with 15 additions and 15 deletions

View file

@ -172,20 +172,20 @@ object Source {
new Source(scaladsl.Source.repeat(element))
/**
* create a `Source` that will unfold a value of type `S` into
* Create a `Source` that will unfold a value of type `S` into
* a pair of the next state `S` and output elements of type `E`.
*/
def unfold[S, E](s: S, f: function.Function[S, Option[(S, E)]]): Source[E, Unit] =
new Source(scaladsl.Source.unfold(s)((s: S) f.apply(s)))
/**
* same as unfold, but uses an async function to generate the next state-element tuple.
* Same as [[unfold]], but uses an async function to generate the next state-element tuple.
*/
def unfoldAsync[S, E](s: S, f: function.Function[S, Future[Option[(S, E)]]]): Source[E, Unit] =
new Source(scaladsl.Source.unfoldAsync(s)((s: S) f.apply(s)))
/**
* simpler unfold, for infinite sequences.
* Simpler [[unfold]], for infinite sequences.
*/
def unfoldInf[S, E](s: S, f: function.Function[S, (S, E)]): Source[E, Unit] = {
new Source(scaladsl.Source.unfoldInf(s)((s: S) f.apply(s)))

View file

@ -245,15 +245,15 @@ object Source {
}
/**
* create a `Source` that will unfold a value of type `S` into
* Create a `Source` that will unfold a value of type `S` into
* a pair of the next state `S` and output elements of type `E`.
*
* for example, all the fibonacci numbers under 10M:
* 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)
* Source.unfold(0 1) {
* case (a, _) if a > 10000000 None
* case (a, b) Some((b (a + b)) a)
* }
* }}}
*/
@ -261,14 +261,14 @@ object Source {
Source.fromGraph(new Unfold(s, f)).withAttributes(DefaultAttributes.unfold)
/**
* same as unfold, but uses an async function to generate the next state-element tuple.
* Same as [[unfold]], but uses an async function to generate the next state-element tuple.
*
* async fibonacci example:
*
* {{{
* Source.unfoldAsync(0 1){
* case (a,_) if a > 10000000 Future.successful(None)
* case (a,b) Future{
* Source.unfoldAsync(0 1) {
* case (a, _) if a > 10000000 Future.successful(None)
* case (a, b) Future{
* Thread.sleep(1000)
* Some((b (a + b)) a)
* }
@ -279,11 +279,11 @@ object Source {
Source.fromGraph(new UnfoldAsync(s, f)).withAttributes(DefaultAttributes.unfoldAsync)
/**
* simpler unfold, for infinite sequences.
* Simpler [[unfold]], for infinite sequences.
*
* {{{
* Source.unfoldInf(0 1){
* case (a,b) (b (a + b)) a
* Source.unfoldInf(0 1) {
* case (a, b) (b (a + b)) a
* }
* }}}
*/