A channel source, which can be used to receive values from the channel. See Channel for more details.
Attributes
Members list
Type members
Classlikes
The clause passed to select, created using receiveClause or receiveOrDoneClause.
The clause passed to select, created using receiveClause or receiveOrDoneClause.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait SelectClause[T]class Objecttrait Matchableclass AnyShow all
Holds the result of a receiveClause that was selected during a call to select.
Holds the result of a receiveClause that was selected during a call to select.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait SelectResult[T]class Objecttrait Matchableclass AnyShow all
Value members
Concrete methods
Attributes
- Returns
-
true
if no more values can be received from this channel; Source.receive will throw ChannelClosedException. When closed for receive, sending values is also not possible, isClosedForSend will returntrue
.
Attributes
- Returns
-
Some
if no more values can be received from this channel; Source.receive will throw ChannelClosedException. When closed for receive, sending values is also not possible, isClosedForSend will returntrue
.
Receive a value from the channel. For a variant which doesn't throw exceptions when the channel is closed, use receiveOrClosed.
Receive a value from the channel. For a variant which doesn't throw exceptions when the channel is closed, use receiveOrClosed.
Attributes
- Returns
-
Either a value of type
T
, or ChannelClosed, when the channel is closed. - Throws
-
ChannelClosedException
If the channel is closed (done or in error).
Receive a value from the channel. For a variant which throws exceptions when the channel is closed, use receive.
Receive a value from the channel. For a variant which throws exceptions when the channel is closed, use receive.
Attributes
- Returns
-
Either a value of type
T
, or ChannelClosed, when the channel is closed.
Receive a value from the channel.
Receive a value from the channel.
Attributes
- Returns
-
Either a value of type
T
, or ChannelClosed.Done, when the channel is done. - Throws
-
ChannelClosedException
If the channel is in error.
- See also
-
receive and receiveOrClosed.
Inherited methods
Applies the given mapping function f
to each value received from this source, for which the function is defined, and sends the results to the returned channel. If f
is not defined at a value, the value will be skipped.
Applies the given mapping function f
to each value received from this source, for which the function is defined, and sends the results to the returned channel. If f
is not defined at a value, the value will be skipped.
Errors from this channel are propagated to the returned channel. Any exceptions that occur when invoking f
are propagated as errors to the returned channel as well.
Must be run within a scope, as a child fork is created, which receives from this source and sends the mapped values to the resulting one.
For a lazily-evaluated version, see collectAsView.
Value parameters
- f
-
The mapping function.
Attributes
- Returns
-
A source, onto which results of the mapping function will be sent.
- Inherited from:
- SourceOps
Creates a view of this source, where the results of receive will be transformed on the consumer's thread using the given function f
. If the function is not defined at a value, the value will be skipped. For an eager, asynchronous version, see collect.
Creates a view of this source, where the results of receive will be transformed on the consumer's thread using the given function f
. If the function is not defined at a value, the value will be skipped. For an eager, asynchronous version, see collect.
The same logic applies to receive clauses created using this source, which can be used in select.
Value parameters
- f
-
The collecting function. Results should not be
null
.
Attributes
- Returns
-
A source which is a view of this source, with the collecting function applied.
- Inherited from:
- SourceOps
Receives all values from the channel. Blocks until the channel is done.
Receives all values from the channel. Blocks until the channel is done.
Attributes
- Throws
-
ChannelClosedException.Error
when there is an upstream error.
- Inherited from:
- SourceDrainOps
The "safe" variant of drain.
Attributes
- Inherited from:
- SourceOps
Lazily-evaluated filter: Creates a view of this source, where the results of receive will be filtered on the consumer's thread using the given predicate p
. For an eager, asynchronous version, see filter.
Lazily-evaluated filter: Creates a view of this source, where the results of receive will be filtered on the consumer's thread using the given predicate p
. For an eager, asynchronous version, see filter.
The same logic applies to receive clauses created using this source, which can be used in select.
Value parameters
- f
-
The predicate to use for filtering.
Attributes
- Returns
-
A source which is a view of this source, with the filtering function applied.
- Inherited from:
- SourceOps
Invokes the given function for each received value. Blocks until the channel is done.
Invokes the given function for each received value. Blocks until the channel is done.
Attributes
- Throws
-
ChannelClosedException.Error
When there is an upstream error.
- Inherited from:
- SourceDrainOps
The "safe" variant of foreach.
Applies the given mapping function f
to each value received from this source, and sends the results to the returned channel.
Applies the given mapping function f
to each value received from this source, and sends the results to the returned channel.
Errors from this channel are propagated to the returned channel. Any exceptions that occur when invoking f
are propagated as errors to the returned channel as well.
Must be run within a scope, as a child fork is created, which receives from this source and sends the mapped values to the resulting one.
For a lazily-evaluated version, see mapAsView.
Value parameters
- f
-
The mapping function.
Attributes
- Returns
-
A source, onto which results of the mapping function will be sent.
- Inherited from:
- SourceOps
Lazily-evaluated map: creates a view of this source, where the results of receive will be transformed on the consumer's thread using the given function f
. For an eager, asynchronous version, see map.
Lazily-evaluated map: creates a view of this source, where the results of receive will be transformed on the consumer's thread using the given function f
. For an eager, asynchronous version, see map.
The same logic applies to receive clauses created using this source, which can be used in select.
Value parameters
- f
-
The mapping function. Results should not be
null
.
Attributes
- Returns
-
A source which is a view of this source, with the mapping function applied.
- Inherited from:
- SourceOps
Passes each received values from this channel to the given sink. Blocks until the channel is done.
Passes each received values from this channel to the given sink. Blocks until the channel is done.
Errors are always propagated. Successful channel completion is propagated when propagateDone
is set to true
.
Attributes
- Inherited from:
- SourceDrainOps
Applies the given consumer function f
to each value received from this source.
Applies the given consumer function f
to each value received from this source.
Errors from this channel are propagated to the returned channel. Any exceptions that occur when invoking f
are propagated as errors to the returned channel as well.
Must be run within a scope, as a child fork is created, which receives from this source and sends the mapped values to the resulting one.
Useful for side-effects without result values, like logging and debugging. For a lazily-evaluated version, see tapAsView.
Value parameters
- f
-
The consumer function.
Attributes
- Returns
-
A source, which the values from the input source are passed to.
- Inherited from:
- SourceOps
Lazily-evaluated tap: creates a view of this source, where the results of receive will be applied to the given function f
on the consumer's thread. Useful for side-effects without result values, like logging and debugging. For an eager, asynchronous version, see tap.
Lazily-evaluated tap: creates a view of this source, where the results of receive will be applied to the given function f
on the consumer's thread. Useful for side-effects without result values, like logging and debugging. For an eager, asynchronous version, see tap.
The same logic applies to receive clauses created using this source, which can be used in select.
Value parameters
- f
-
The consumer function.
Attributes
- Returns
-
A source which is a view of this source, with the consumer function applied.
- Inherited from:
- SourceOps
Accumulates all values received from the channel into a list. Blocks until the channel is done.
Accumulates all values received from the channel into a list. Blocks until the channel is done.
Attributes
- Throws
-
ChannelClosedException.Error
When there is an upstream error.
- Inherited from:
- SourceDrainOps
The "safe" variant of toList.
Attributes
- Inherited from:
- SourceOps