OxL Reference

enum Pulled

Outcome of one pull (stream.pull, stream.pullWithin).

Example:

oxl✓ checked in CI
fn numbers() -> stream<i64> {
  yield 1
  yield 2
}

fn main() io {
  var s = numbers()
  var more = true
  while more {
    match s.pull() {
      Pulled.Item(v) => print("item {v}")
      Pulled.Failed(e) => more = false
      Pulled.End => more = false
      Pulled.Timeout => more = false
    }
  }
  print("end")
}
Output
item 1
item 2
end
pub(api) enum Pulled<T, E>

Since. 1.0.0-beta

Variants

Item(value: T)

The next element.

Failed(error: E)

The stream ended with this error (no more pulls produce anything).

End

The stream ended normally.

Timeout

pullWithin: nothing arrived in time; the stream is still open and the next pull goes on waiting.

Defined in: std/core/stream.oxl:36

See also