OxL Reference

method Receiver.tryRecv

Non-blocking receive.

Example:

oxl✓ checked in CI
fn main() io {
  let (tx, rx) = chan<i64>(cap: 1)
  print("{rx.tryRecv()}")
  tx.send(3)!
  print("{rx.tryRecv()}")
}
Output
none
3
pub(api) fn tryRecv() -> T?

Complexity. O(1); never waits.

Since. 1.0.0-beta

Returns

T?

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/task.oxl:137

See also