OxL Справочник OxL
РусскийEnglish

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✓ проверяется в 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")
  }
}
Вывод
nothing yet
pub(api) var fn pullWithin(d: Duration) -> Pulled<T, E>

С версии. 1.0.0-beta

Параметры

ИмяТип
dDuration

Возвращает

Pulled<T, E>

Эффекты

не объявлены (чистая, пока тело не говорит иное)

Определено в: std/core/stream.oxl:96

См. также