Sink

ox.channels.Sink
trait Sink[-T]

A channel sink, which can be used to send values to the channel. See Channel for more details.

Attributes

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

Members list

Type members

Classlikes

case class Send extends SelectClause[Unit]

The clause passed to select, created using sendClause.

The clause passed to select, created using sendClause.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait SelectClause[Unit]
class Object
trait Matchable
class Any
Show all
case class Sent extends SelectResult[Unit]

Holds the result of a sendClause that was selected during a call to select.

Holds the result of a sendClause that was selected during a call to select.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait SelectResult[Unit]
class Object
trait Matchable
class Any
Show all

Value members

Abstract methods

protected def delegate: Sink[Any]

Concrete methods

def done(): Unit

Close the channel, indicating that no more values will be sent. Doesn't throw exceptions when the channel is closed, but returns a value.

Close the channel, indicating that no more values will be sent. Doesn't throw exceptions when the channel is closed, but returns a value.

Any values that are already buffered will be delivered. Any send operations that are in progress will complete normally, when a receiver arrives. Any pending receive operations will complete with a channel closed result.

Subsequent send operations will throw ChannelClosedException.

For a variant which doesn't throw exceptions when the channel is closed, use doneOrClosed.

Attributes

Throws
ChannelClosedException

If the channel is already closed.

def doneOrClosed(): Unit | ChannelClosed

Close the channel, indicating that no more values will be sent. Doesn't throw exceptions when the channel is closed, but returns a value.

Close the channel, indicating that no more values will be sent. Doesn't throw exceptions when the channel is closed, but returns a value.

Any values that are already buffered will be delivered. Any send operations that are in progress will complete normally, when a receiver arrives. Any pending receive operations will complete with a channel closed result.

Subsequent sendOrClosed operations will return ChannelClosed.

For a variant which throws exceptions when the channel is closed, use done.

Attributes

Returns

Either (), or ChannelClosed, when the channel is already closed.

def error(reason: Throwable): Unit

Close the channel, indicating an error.

Close the channel, indicating an error.

Any values that are already buffered won't be delivered. Any send or receive operations that are in progress will complete with a channel closed result.

Subsequent send and Source.receive operations will throw ChannelClosedException.

For a variant which doesn't throw exceptions when the channel is closed, use errorOrClosed.

Value parameters

reason

The reason of the error.

Attributes

Throws
ChannelClosedException

If the channel is already closed.

def errorOrClosed(reason: Throwable): Unit | ChannelClosed

Close the channel, indicating an error.

Close the channel, indicating an error.

Any values that are already buffered won't be delivered. Any send or receive operations that are in progress will complete with a channel closed result.

Subsequent sendOrClosed and Source.receiveOrClosed operations will return ChannelClosed.

For a variant which throws exceptions when the channel is closed, use error.

Value parameters

reason

The reason of the error.

Attributes

Returns

Either (), or ChannelClosed, when the channel is already closed.

def isClosedForSend: Boolean

Attributes

Returns

true if no more values can be sent to this channel; Sink.sendOrClosed will return ChannelClosed. When closed for send, receiving using Source.receive might still be possible, if the channel is done, and not in an error. This can be verified using isClosedForReceive.

Attributes

Returns

Some if no more values can be sent to this channel; Sink.sendOrClosed will return ChannelClosed. When closed for send, receiving using Source.receive might still be possible, if the channel is done, and not in an error. This can be verified using isClosedForReceive.

def send(t: T): Unit

Send a value to the channel. For a variant which doesn't throw exceptions when the channel is closed, use sendOrClosed.

Send a value to the channel. For a variant which doesn't throw exceptions when the channel is closed, use sendOrClosed.

Value parameters

t

The value to send. Not null.

Attributes

Throws
ChannelClosedException

If the channel is closed (done or in error).

def sendClause(t: T): Send

Create a clause which can be used in select. The clause will send the given value to the current channel, and return () as the clause's result.

Create a clause which can be used in select. The clause will send the given value to the current channel, and return () as the clause's result.

Attributes

def sendOrClosed(t: T): Unit | ChannelClosed

Send a value to the channel. For a variant which throws exceptions when the channel is closed, use send.

Send a value to the channel. For a variant which throws exceptions when the channel is closed, use send.

Value parameters

t

The value to send. Not null.

Attributes

Returns

Either (), or ChannelClosed, when the channel is closed.