pjfanning commented on code in PR #1831: URL: https://github.com/apache/pekko/pull/1831#discussion_r2107197962
########## 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: @mdedetrich would it be possible to address this point? -- 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: notifications-unsubscr...@pekko.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org For additional commands, e-mail: notifications-h...@pekko.apache.org