ReadableChannel

gears.async.ReadableChannel
trait ReadableChannel[+T]

The part of a channel one can read values from. Blocking behavior depends on the implementation.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Channel[T]
trait BufferedChannel[T]
trait UnboundedChannel[T]
trait SyncChannel[T]

Members list

Value members

Concrete methods

def read()(using Async): Res[T]

Read an item from the channel, suspending until the item has been received. Returns Failure(ChannelClosedException) if the channel was closed.

Read an item from the channel, suspending until the item has been received. Returns Failure(ChannelClosedException) if the channel was closed.

Attributes

Abstract fields

val readSource: Source[Res[T]]

An Async.Source corresponding to items being sent over the channel. Note that each listener attached to and accepting a Right value corresponds to one value received over the channel.

An Async.Source corresponding to items being sent over the channel. Note that each listener attached to and accepting a Right value corresponds to one value received over the channel.

To create an Async.Source that reads exactly one item regardless of listeners attached, wrap the read operation inside a gears.async.Future.

val readOnce = Future(ch.read(x))

Attributes