OxL Reference

method stream.pull

Waits for the next element (a suspension point and cancellation point).

Example:

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

fn main() io {
  var s = numbers()
  match s.pull() {
    Pulled.Item(v) => print("first {v}")
    _ => print("nothing")
  }
  match s.pull() {
    Pulled.End => print("end")
    _ => print("more")
  }
}
Output
first 7
end
pub(api) var fn pull() -> Pulled<T, E>

Complexity. O(1) plus the wait for the producer.

Since. 1.0.0-beta

Returns

Pulled<T, E>

Effects

none declared (pure unless the body says otherwise)

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

See also