OxL Reference

method stream.pullWithin

Like pull, but gives up after d with Timeout. Streams backed by a callback source that cannot be interrupted (remote streams) wait without limit.

Example:

oxl✓ checked in CI
fn slow() -> stream<i64> time {
  sleep(300ms)
  yield 1
}

fn main() io, time {
  var s = slow()
  match s.pullWithin(20ms) {
    Pulled.Timeout => print("nothing yet")
    _ => print("too fast")
  }
}
Output
nothing yet
pub(api) var fn pullWithin(d: Duration) -> Pulled<T, E>

Since. 1.0.0-beta

Parameters

NameType
dDuration

Returns

Pulled<T, E>

Effects

none declared (pure unless the body says otherwise)

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

See also