19452: Contramap and fromFunction
This commit is contained in:
parent
d9b47c3a8d
commit
6c69fba61e
8 changed files with 71 additions and 3 deletions
|
|
@ -284,6 +284,12 @@ object Flow {
|
|||
*/
|
||||
def apply[T]: Flow[T, T, NotUsed] = identity.asInstanceOf[Flow[T, T, NotUsed]]
|
||||
|
||||
/**
|
||||
* Creates a [Flow] which will use the given function to transform its inputs to outputs. It is equivalent
|
||||
* to `Flow[T].map(f)`
|
||||
*/
|
||||
def fromFunction[A, B](f: A ⇒ B): Flow[A, B, NotUsed] = apply[A].map(f)
|
||||
|
||||
/**
|
||||
* A graph with the shape of a flow logically is a flow, this method makes
|
||||
* it so also in type.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue