-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Source.interleave combinator #12
Conversation
698d3f4
to
151b52b
Compare
* scala> val res0: List[Int] = List(1, 2, 10, 20, 3, 4, 30, 40) | ||
* }}} | ||
*/ | ||
def interleave[U >: T](other: Source[U], segmentSize: Int = 1)(using Ox, StageCapacity): Source[U] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to consider: optionally close the resulting source if either of the source-sources are done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, good idea.
Do we also want to add some more flexibility by allowing to interleave with more than one source (like https://doc.akka.io/docs/akka/current/stream/operators/Source-or-Flow/interleaveAll.html)? Then the internal implementation of interleave
would be more generic, since at the moment it is "optimized" for exactly two sources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could simply add an interleaveAll
method :)
Looks good, exactly the kind of PR I was looking for :) |
No description provided.