Various operations which allow creating Source instances.
Some need to be run within a concurrency scope, such as supervised.
Attributes
Members list
Value members
Inherited methods
Creates an empty source, that is immediately completed as done.
Creates an empty source, that is immediately completed as done.
Attributes
- Inherited from:
- SourceCompanionOps
Creates a source that fails immediately with the given java.lang.Throwable
Creates a source that fails immediately with the given java.lang.Throwable
Value parameters
- t
-
The java.lang.Throwable to fail with
Attributes
- Returns
-
A source that would fail immediately with the given java.lang.Throwable
- Inherited from:
- SourceCompanionOps
Attributes
- Inherited from:
- SourceCompanionOps
Creates a source that emits a single value when from
completes or fails otherwise. The from
completion is performed on the provided scala.concurrent.ExecutionContext. Note that when from
fails with scala.concurrent.ExecutionException then its cause is returned as source failure.
Creates a source that emits a single value when from
completes or fails otherwise. The from
completion is performed on the provided scala.concurrent.ExecutionContext. Note that when from
fails with scala.concurrent.ExecutionException then its cause is returned as source failure.
Value parameters
- from
-
A scala.concurrent.Future that returns value upon completion.
Attributes
- Returns
-
A source that will emit value upon a
from
scala.concurrent.Future completion. - Example
-
import ox.* import ox.channels.Source import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future supervised { Source .future(Future.failed(new RuntimeException("future failed"))) .receive() // ChannelClosed.Error(java.lang.RuntimeException: future failed) Source.future(Future.successful(1)).toList // List(1) }
- Inherited from:
- SourceCompanionOps
Creates a source to which the future's value is sent, once from
completes or fails otherwise. The from
completion is performed on the provided scala.concurrent.ExecutionContext. Note that when from
fails with scala.concurrent.ExecutionException then its cause is returned as source failure.
Creates a source to which the future's value is sent, once from
completes or fails otherwise. The from
completion is performed on the provided scala.concurrent.ExecutionContext. Note that when from
fails with scala.concurrent.ExecutionException then its cause is returned as source failure.
Value parameters
- from
-
A scala.concurrent.Future that returns source upon completion.
Attributes
- Returns
-
A source that will emit values upon a
from
scala.concurrent.Future completion. - Example
-
import ox.* import ox.channels.Source import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future supervised { Source .futureSource(Future.failed(new RuntimeException("future failed"))) .receive() // ChannelClosed.Error(java.lang.RuntimeException: future failed) Source.futureSource(Future.successful(Source.fromValues(1, 2))).toList // List(1, 2) }
- Inherited from:
- SourceCompanionOps
Attributes
- Inherited from:
- SourceCompanionOps
Attributes
- Inherited from:
- SourceCompanionOps
Attributes
- Inherited from:
- SourceCompanionOps