Docs: Source.repeat (and friends) (#28615)
This commit is contained in:
parent
d946abd8d7
commit
cff15cf40d
6 changed files with 64 additions and 16 deletions
|
|
@ -1,20 +1,34 @@
|
|||
# Source.repeat
|
||||
|
||||
Stream a single object repeatedly
|
||||
Stream a single object repeatedly.
|
||||
|
||||
@ref[Source operators](../index.md#source-operators)
|
||||
|
||||
@@@div { .group-scala }
|
||||
|
||||
## Signature
|
||||
|
||||
@@signature [Source.scala](/akka-stream/src/main/scala/akka/stream/scaladsl/Source.scala) { #repeat }
|
||||
|
||||
@@@
|
||||
@apidoc[Source.repeat](Source$) { scala="#repeat[T](element:T):akka.stream.scaladsl.Source[T,akka.NotUsed]" java="#repeat(T)" }
|
||||
|
||||
## Description
|
||||
|
||||
Stream a single object repeatedly
|
||||
This source emits a single element repeatedly. It never completes, if you want the stream to be finite you will need to limit it by combining with another operator
|
||||
|
||||
See also:
|
||||
|
||||
* @ref:[`single`](single.md) Stream a single object once.
|
||||
* @ref:[`tick`](tick.md) A periodical repetition of an arbitrary object.
|
||||
* @ref:[`cycle`](cycle.md) Stream iterator in cycled manner.
|
||||
|
||||
## Example
|
||||
|
||||
This example prints the first 4 elements emitted by `Source.repeat`.
|
||||
|
||||
Scala
|
||||
: @@snip [snip](/akka-stream-tests/src/test/scala/akka/stream/scaladsl/SourceSpec.scala) { #repeat }
|
||||
|
||||
Java
|
||||
: @@snip [snip](/akka-stream-tests/src/test/java/akka/stream/javadsl/SourceTest.java) { #repeat }
|
||||
|
||||
|
||||
|
||||
## Reactive Streams semantics
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,22 @@
|
|||
# Source.single
|
||||
|
||||
Stream a single object
|
||||
Stream a single object once.
|
||||
|
||||
@ref[Source operators](../index.md#source-operators)
|
||||
|
||||
@@@div { .group-scala }
|
||||
|
||||
## Signature
|
||||
|
||||
@@signature [Source.scala](/akka-stream/src/main/scala/akka/stream/scaladsl/Source.scala) { #single }
|
||||
|
||||
@@@
|
||||
@apidoc[Source.single](Source$) { scala="#single[T](element:T):akka.stream.scaladsl.Source[T,akka.NotUsed]" java="#single(T)" }
|
||||
|
||||
## Description
|
||||
|
||||
Stream a single object
|
||||
Stream a single object once and complete after thereafter.
|
||||
|
||||
See also:
|
||||
|
||||
* @ref:[`repeat`](repeat.md) Stream a single object repeatedly.
|
||||
* @ref:[`tick`](tick.md) A periodical repetition of an arbitrary object.
|
||||
* @ref:[`cycle`](cycle.md) Stream iterator in cycled manner.
|
||||
|
||||
## Examples
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@ example for achieving a periodical element that changes over time.
|
|||
|
||||
@@@
|
||||
|
||||
See also:
|
||||
|
||||
* @ref:[`repeat`](repeat.md) Stream a single object repeatedly.
|
||||
* @ref:[`cycle`](cycle.md) Stream iterator in cycled manner.
|
||||
|
||||
## Examples
|
||||
|
||||
This first example prints to standard out periodically:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue