mdedetrich commented on code in PR #1831:
URL: https://github.com/apache/pekko/pull/1831#discussion_r2248291044
##########
stream/src/main/scala/org/apache/pekko/stream/scaladsl/Source.scala:
##########
@@ -108,6 +108,21 @@ final class Source[+Out, +Mat](
(mat, Source.fromPublisher(pub))
}
+ /**
+ * Materializes this [[Source]] using the [[Sink]], immediately returning
the values via the
+ * provided [[Sink]] as a new [[Source]].
+ *
+ * @param sink A sink which needs to materialize into a [[Future]],
typically one
+ * that collects values such as [[Sink.head]] or [[Sink.seq]]
+ * @return A new [[Source]] that contains the results of the provided
[[Source]]'s
+ * elements run with the [[Sink]]
+ * @since 1.2.0
+ */
+ def preMaterializeIntoSource[Mat2](sink: Graph[SinkShape[Out],
Future[Mat2]]): Source[Mat2, Future[NotUsed]] =
+ Source.fromMaterializer { (mat, attr) =>
+
Source.future(this.withAttributes(attr).toMat(sink)(Keep.right).run()(mat))
Review Comment:
Ill look into this on the weekend
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]