SendableChannel

gears.async.SendableChannel
trait SendableChannel[-T]

The part of a channel one can send values to. 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

Abstract methods

def sendSource(x: T): Source[Res[Unit]]

Create an Async.Source representing the send action of value x.

Create an Async.Source representing the send action of value x.

Note that each listener attached to and accepting an Unit value corresponds to x being sent once.

To create an Async.Source that sends the item exactly once regardless of listeners attached, wrap the send operation inside a gears.async.Future:

val sendOnce = Future(ch.send(x))

Attributes

Returns

an Async.Source that resolves with Right(()) when x is sent to the channel, or Left(Closed) if the channel is already closed. This source will perform a send operation every time a listener is attached to it, or every time it is Async$.awaited on.

Concrete methods

def send(x: T)(using Async): Unit

Send x over the channel, suspending until the item has been sent or, if the channel is buffered, queued.

Send x over the channel, suspending until the item has been sent or, if the channel is buffered, queued.

Attributes

Throws
ChannelClosedException

if the channel was closed.