OxL Reference

data Receiver

The receiving end of a channel made by chan<T>(cap).

Example:

oxl✓ checked in CI
fn main() io {
  let (tx, rx) = chan<str>(cap: 1)
  tx.send("hi")!
  print("{rx.tryRecv()} {rx.tryRecv()}")
}
Output
hi none
@builtin("Receiver") pub(api) data Receiver<T>

Thread safety. owned by the task that receives.

Since. 1.0.0-beta

Methods

recv() -> T | Closed
Receives a value, waiting while the channel is empty; Closed after all senders are gone.
tryRecv() -> T?
Non-blocking receive.

Defined in: std/core/types.oxl:492

See also