Fix incorrect materialized types = Unit in stream documentation (#21938)
* Fix incorrect materialized types = Unit in stream documentation (Fixes #21937) * Correct Int, which should be Integer in Java * Replace BoxedUnit in stream doc
This commit is contained in:
parent
c38d3850a2
commit
3df22baf3a
8 changed files with 15 additions and 15 deletions
|
|
@ -181,7 +181,7 @@ class CompositionDocSpec extends AkkaSpec {
|
|||
// Materializes to Promise[Option[Int]] (red)
|
||||
val source: Source[Int, Promise[Option[Int]]] = Source.maybe[Int]
|
||||
|
||||
// Materializes to Unit (black)
|
||||
// Materializes to NotUsed (black)
|
||||
val flow1: Flow[Int, Int, NotUsed] = Flow[Int].take(100)
|
||||
|
||||
// Materializes to Promise[Int] (red)
|
||||
|
|
@ -190,7 +190,7 @@ class CompositionDocSpec extends AkkaSpec {
|
|||
//#mat-combine-1
|
||||
|
||||
//#mat-combine-2
|
||||
// Materializes to Unit (orange)
|
||||
// Materializes to NotUsed (orange)
|
||||
val flow2: Flow[Int, ByteString, NotUsed] = Flow[Int].map { i => ByteString(i.toString) }
|
||||
|
||||
// Materializes to Future[OutgoingConnection] (yellow)
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ The propagation of the individual materialized values from the enclosed modules
|
|||
|
|
||||
|
||||
To implement the above, first, we create a composite :class:`Source`, where the enclosed :class:`Source` have a
|
||||
materialized type of :class:`Promise[Unit]`. By using the combiner function ``Keep.left``, the resulting materialized
|
||||
materialized type of :class:`Promise[[Option[Int]]`. By using the combiner function ``Keep.left``, the resulting materialized
|
||||
type is of the nested module (indicated by the color *red* on the diagram):
|
||||
|
||||
.. includecode:: ../code/docs/stream/CompositionDocSpec.scala#mat-combine-1
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ is how it looks like in the end:
|
|||
|
||||
.. includecode:: ../code/docs/stream/GraphStageDocSpec.scala#custom-source-example
|
||||
|
||||
Instances of the above :class:`GraphStage` are subclasses of ``Graph[SourceShape[Int],Unit]`` which means
|
||||
Instances of the above :class:`GraphStage` are subclasses of ``Graph[SourceShape[Int],NotUsed]`` which means
|
||||
that they are already usable in many situations, but do not provide the DSL methods we usually have for other
|
||||
:class:`Source` s. In order to convert this :class:`Graph` to a proper :class:`Source` we need to wrap it using
|
||||
``Source.fromGraph`` (see :ref:`composition-scala` for more details about graphs and DSLs). Now we can use the
|
||||
|
|
@ -385,7 +385,7 @@ or ``unwatch(ref)`` methods. The reference can be also watched by external actor
|
|||
Custom materialized values
|
||||
--------------------------
|
||||
|
||||
Custom stages can return materialized values instead of ``Unit`` by inheriting from :class:`GraphStageWithMaterializedValue`
|
||||
Custom stages can return materialized values instead of ``NotUsed`` by inheriting from :class:`GraphStageWithMaterializedValue`
|
||||
instead of the simpler :class:`GraphStage`. The difference is that in this case the method
|
||||
``createLogicAndMaterializedValue(inheritedAttributes)`` needs to be overridden, and in addition to the
|
||||
stage logic the materialized value must be provided
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ As you can see, inside the :class:`GraphDSL` we use an implicit graph builder ``
|
|||
using the ``~>`` "edge operator" (also read as "connect" or "via" or "to"). The operator is provided implicitly
|
||||
by importing ``GraphDSL.Implicits._``.
|
||||
|
||||
``GraphDSL.create`` returns a :class:`Graph`, in this example a :class:`Graph[ClosedShape, Unit]` where
|
||||
``GraphDSL.create`` returns a :class:`Graph`, in this example a :class:`Graph[ClosedShape, NotUsed]` where
|
||||
:class:`ClosedShape` means that it is *a fully connected graph* or "closed" - there are no unconnected inputs or outputs.
|
||||
Since it is closed it is possible to transform the graph into a :class:`RunnableGraph` using ``RunnableGraph.fromGraph``.
|
||||
The runnable graph can then be ``run()`` to materialize a stream out of it.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue