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:
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
Параметры
| Имя | Тип |
|---|---|
d | Duration |
Возвращает
Pulled<T, E>
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/core/stream.oxl:96