19452: Contramap and fromFunction
This commit is contained in:
parent
d9b47c3a8d
commit
6c69fba61e
8 changed files with 71 additions and 3 deletions
|
|
@ -265,6 +265,17 @@ final class Sink[-In, +Mat](delegate: scaladsl.Sink[In, Mat]) extends Graph[Sink
|
|||
def runWith[M](source: Graph[SourceShape[In], M], materializer: Materializer): M =
|
||||
asScala.runWith(source)(materializer)
|
||||
|
||||
/**
|
||||
* Transform this Sink by applying a function to each *incoming* upstream element before
|
||||
* it is passed to the [[Sink]]
|
||||
*
|
||||
* '''Backpressures when''' original [[Sink]] backpressures
|
||||
*
|
||||
* '''Cancels when''' original [[Sink]] backpressures
|
||||
*/
|
||||
def contramap[In2](f: function.Function[In2, In]): Sink[In2, Mat] =
|
||||
javadsl.Flow.fromFunction(f).toMat(this, Keep.right[NotUsed, Mat])
|
||||
|
||||
/**
|
||||
* Transform only the materialized value of this Sink, leaving all other properties as they were.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue