parent
e44fafd4b7
commit
3ea59b1e76
7 changed files with 135 additions and 4 deletions
|
|
@ -87,6 +87,15 @@ final class Source[+Out, +Mat](
|
|||
override def mapMaterializedValue[Mat2](f: Mat ⇒ Mat2): ReprMat[Out, Mat2] =
|
||||
new Source[Out, Mat2](traversalBuilder.transformMat(f.asInstanceOf[Any ⇒ Any]), shape)
|
||||
|
||||
/**
|
||||
* Materializes this Source, immediately returning (1) its materialized value, and (2) a new Source
|
||||
* that can be used to consume elements from the newly materialized Source.
|
||||
*/
|
||||
def preMaterialize()(implicit materializer: Materializer): (Mat, ReprMat[Out, NotUsed]) = {
|
||||
val (mat, pub) = toMat(Sink.asPublisher(fanout = true))(Keep.both).run()
|
||||
(mat, Source.fromPublisher(pub))
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect this `Source` to a `Sink` and run it. The returned value is the materialized value
|
||||
* of the `Sink`, e.g. the `Publisher` of a [[akka.stream.scaladsl.Sink#publisher]].
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue