ox.channels

package ox.channels

Members list

Type members

Classlikes

class BufferedChannel[T](capacity: Int) extends Channel[T]

Attributes

Supertypes
trait Channel[T]
trait Sink[T]
trait Source[T]
trait Stateful
trait SourceOps[T]
class Object
trait Matchable
class Any
Show all
trait Channel[T] extends Source[T], Sink[T]

Attributes

Companion
object
Supertypes
trait Sink[T]
trait Source[T]
trait Stateful
trait SourceOps[T]
class Object
trait Matchable
class Any
Show all
Known subtypes
class BufferedChannel[T]
class DirectChannel[T]
object Channel

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Channel.type
sealed trait ChannelClosed

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Done.type
class Error
object ChannelClosed

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
enum ChannelClosedException(reason: Option[Throwable]) extends Exception

Attributes

Supertypes
trait Enum
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
Known subtypes
case Error
case Done
class CollectSource[T, U](s: Source[T], f: T => Option[U]) extends Source[U]

Attributes

Supertypes
trait Source[U]
trait Stateful
trait SourceOps[U]
class Object
trait Matchable
class Any
Show all
case class Default[T](value: T) extends SelectClause[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait SelectClause[T]
class Object
trait Matchable
class Any
Show all
case class DefaultResult[T](value: T) extends SelectResult[T]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait SelectResult[T]
class Object
trait Matchable
class Any
Show all
class DirectChannel[T] extends Channel[T]

A channel with capacity 0, requiring that senders & receivers meet to exchange a value.

A channel with capacity 0, requiring that senders & receivers meet to exchange a value.

Attributes

Supertypes
trait Channel[T]
trait Sink[T]
trait Source[T]
trait Stateful
trait SourceOps[T]
class Object
trait Matchable
class Any
Show all
sealed trait SelectClause[+T]

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Receive
trait Send
class BufferedSend
class DirectSend
class Default[T]
sealed trait SelectResult[+T]

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Received
class Sent
class DefaultResult[T]
trait Sink[-T] extends Stateful

Attributes

Supertypes
trait Stateful
class Object
trait Matchable
class Any
Known subtypes
trait Channel[T]
class BufferedChannel[T]
class DirectChannel[T]
trait Source[+T] extends SourceOps[T], Stateful

Attributes

Companion
object
Supertypes
trait Stateful
trait SourceOps[T]
class Object
trait Matchable
class Any
Known subtypes
trait Channel[T]
class BufferedChannel[T]
class DirectChannel[T]
class CollectSource[T, U]
object Source extends SourceCompanionOps

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Source.type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Source.type
trait SourceOps[+T]

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Source[T]
trait Channel[T]
class BufferedChannel[T]
class DirectChannel[T]
class CollectSource[T, U]
Self type
Source[T]
object StageCapacity

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
trait Stateful

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Sink[T]
trait Channel[T]
class BufferedChannel[T]
class DirectChannel[T]
trait Source[T]
class CollectSource[T, U]
Show all

Types

opaque type StageCapacity

Value members

Concrete methods

def cellTakeInterrupted[T](c: Cell[T], e: InterruptedException): SelectResult[T] | ChannelClosed
def cleanupCell[T](from: List[SelectClause[T]], cell: Cell[T], alsoWhenSingleClause: Boolean): Boolean

Attributes

Returns

true if the cell was removed from all queues; false if there was at least one queue, from which the cell was absent

def offerAndTrySatisfy[T](ccs: List[SelectClause[T]], c: Cell[T], allDone: Boolean, offeredTo: List[SelectClause[T]]): (Unit | ChannelClosed, List[SelectClause[T]])
def select(clause1: SelectClause[_], clause2: SelectClause[_]): Result | Result | ChannelClosed
def select(clause1: SelectClause[_], clause2: SelectClause[_], clause3: SelectClause[_]): Result | Result | Result | ChannelClosed
def select[T1, T2](source1: Source[T1], source2: Source[T2]): T1 | T2 | ChannelClosed
def select[T1, T2, T3](source1: Source[T1], source2: Source[T2], source3: Source[T3]): T1 | T2 | T3 | ChannelClosed
def select[T](clauses: List[SelectClause[T]]): SelectResult[T] | ChannelClosed

The select is biased towards the clauses first on the list. To ensure fairness, you might want to randomize the clause order using

The select is biased towards the clauses first on the list. To ensure fairness, you might want to randomize the clause order using

Random.shuffle(clauses)

.

Attributes

def select[T](sources: List[Source[T]])(using DummyImplicit): T | ChannelClosed
def trySatisfyNow[T](ccs: List[SelectClause[T]], c: Cell[T], allDone: Boolean): Boolean | (ChannelClosed, Boolean)

Attributes

Returns

true if the cell has been (immediately) satisfied (without owning it).

Extensions

Extensions

extension [T](v: T | ChannelClosed)(v: T | ChannelClosed)
def isValue: Boolean
def map[U](f: T => U): U | ChannelClosed
def orThrow: T