+str #16547 "lazyEmpty" source, which allows external triggering of completion

This commit is contained in:
Konrad Malawski 2015-01-29 10:21:54 +01:00
parent 580ba8c484
commit 85c286ac58
4 changed files with 116 additions and 3 deletions

View file

@ -177,6 +177,17 @@ object Source {
def empty[T](): Source[T] = _empty
private[this] val _empty: Source[Nothing] = apply(EmptyPublisher)
/**
* Create a `Source` with no elements, which does not complete its downstream,
* until externally triggered to do so.
*
* It materializes a [[scala.concurrent.Promise]] which will be completed
* when the downstream stage of this source cancels. This promise can also
* be used to externally trigger completion, which the source then signalls
* to its downstream.
*/
def lazyEmpty[T]() = LazyEmptySource[T]()
/**
* Create a `Source` that immediately ends the stream with the `cause` error to every connected `Sink`.
*/