Note in the docs that the zero value for fold and friends must be immutable #24971

This commit is contained in:
Jeffrey Chung 2018-06-19 06:33:49 -04:00 committed by Johan Andrén
parent 8ea9f9f32b
commit 72bd3cdfd4
10 changed files with 63 additions and 16 deletions

View file

@ -1554,6 +1554,8 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
*
* Adheres to the [[ActorAttributes.SupervisionStrategy]] attribute.
*
* Note that the `zero` value must be immutable.
*
* '''Emits when''' the function scanning the element returns a new element
*
* '''Backpressures when''' downstream backpressures
@ -1581,6 +1583,8 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
*
* Adheres to the [[ActorAttributes.SupervisionStrategy]] attribute.
*
* Note that the `zero` value must be immutable.
*
* '''Emits when''' the future returned by f` completes
*
* '''Backpressures when''' downstream backpressures
@ -1593,6 +1597,7 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
*/
def scanAsync[T](zero: T)(f: function.Function2[T, Out, CompletionStage[T]]): javadsl.Source[T, Mat] =
new Source(delegate.scanAsync(zero) { (out, in) f(out, in).toScala })
/**
* Similar to `scan` but only emits its result when the upstream completes,
* after which it also completes. Applies the given function `f` towards its current and next value,
@ -1604,6 +1609,8 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
* [[akka.stream.Supervision#restart]] current value starts at `zero` again
* the stream will continue.
*
* Note that the `zero` value must be immutable.
*
* '''Emits when''' upstream completes
*
* '''Backpressures when''' downstream backpressures
@ -1626,6 +1633,8 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
* [[akka.stream.Supervision.Restart]] current value starts at `zero` again
* the stream will continue.
*
* Note that the `zero` value must be immutable.
*
* '''Emits when''' upstream completes
*
* '''Backpressures when''' downstream backpressures