+str #18679 add BidiFlow.mapMaterializedValue

This commit is contained in:
Johannes Rudolph 2015-10-08 17:09:37 +02:00
parent 0756a2ff68
commit ac8a5bad60
2 changed files with 12 additions and 0 deletions

View file

@ -152,6 +152,12 @@ class BidiFlow[-I1, +O1, -I2, +O2, +Mat](delegate: scaladsl.BidiFlow[I1, O1, I2,
*/
def reversed: BidiFlow[I2, O2, I1, O1, Mat] = new BidiFlow(delegate.reversed)
/**
* Transform only the materialized value of this BidiFlow, leaving all other properties as they were.
*/
def mapMaterializedValue[Mat2](f: function.Function[Mat, Mat2]): BidiFlow[I1, O1, I2, O2, Mat2] =
new BidiFlow(delegate.mapMaterializedValue(f.apply _))
override def withAttributes(attr: Attributes): BidiFlow[I1, O1, I2, O2, Mat] =
new BidiFlow(delegate.withAttributes(attr))
}

View file

@ -117,6 +117,12 @@ final class BidiFlow[-I1, +O1, -I2, +O2, +Mat](private[stream] override val modu
*/
def reversed: BidiFlow[I2, O2, I1, O1, Mat] = new BidiFlow(module.replaceShape(shape.reversed))
/**
* Transform only the materialized value of this BidiFlow, leaving all other properties as they were.
*/
def mapMaterializedValue[Mat2](f: Mat Mat2): BidiFlow[I1, O1, I2, O2, Mat2] =
new BidiFlow(module.transformMaterializedValue(f.asInstanceOf[Any Any]))
override def withAttributes(attr: Attributes): BidiFlow[I1, O1, I2, O2, Mat] =
new BidiFlow(module.withAttributes(attr).nest())