=str - fixing TODO about scaladsl & javadsl Source/Sink/Flow/BidiFlow.wrap not having to needlessly re-wrap

This commit is contained in:
Viktor Klang 2015-06-06 17:17:23 +02:00
parent 8527e0347e
commit 3bf1c14b3a
8 changed files with 41 additions and 9 deletions

View file

@ -202,8 +202,10 @@ object Source extends SourceApply {
* A graph with the shape of a source logically is a source, this method makes
* it so also in type.
*/
// TODO optimize if no wrapping needed
def wrap[T, M](g: Graph[SourceShape[T], M]): Source[T, M] = new Source(g.module)
def wrap[T, M](g: Graph[SourceShape[T], M]): Source[T, M] = g match {
case s: Source[T, M] s
case other new Source(other.module)
}
/**
* Helper to create [[Source]] from `Iterable`.