Lyricdev
GitHub

class Select

pub class Select

The way into a select, a wait on several channels at once.

Select.on(a) { … }.on(b) { … }.timeout(d) { … }.run() waits on the channels a and b at once and runs the case of the first to have a value — or the timeout's, when d passed first.

Methods

pub static fn on<T>(c: Channel<T>, body: fn(?T) -> void throws Error): Selection

Creates a select with its first case: a receive from c (see Selection.on).