Lazy source (#21081)
This commit is contained in:
parent
0d4858c627
commit
267f31149c
7 changed files with 218 additions and 1 deletions
|
|
@ -355,6 +355,14 @@ object Source {
|
|||
DefaultAttributes.failedSource,
|
||||
shape("FailedSource")))
|
||||
|
||||
/**
|
||||
* Creates a `Source` that is not materialized until there is downstream demand, when the source gets materialized
|
||||
* the materialized future is completed with its value, if downstream cancels or fails without any demand the
|
||||
* create factory is never called and the materialized `Future` is failed.
|
||||
*/
|
||||
def lazily[T, M](create: () => Source[T, M]): Source[T, Future[M]] =
|
||||
Source.fromGraph(new LazySource[T, M](create))
|
||||
|
||||
/**
|
||||
* Creates a `Source` that is materialized as a [[org.reactivestreams.Subscriber]]
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue