method stream.pull
Waits for the next element (a suspension point and cancellation point).
Example:
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")
}
}Вывод
first 7 end
pub(api) var fn pull() -> Pulled<T, E>Сложность. O(1) plus the wait for the producer.
С версии. 1.0.0-beta
Возвращает
Pulled<T, E>
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/core/stream.oxl:74