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

enum Pulled

Outcome of one pull (stream.pull, stream.pullWithin).

Example:

oxl✓ проверяется в CI
fn numbers() -> stream<i64> {
  yield 1
  yield 2
}

fn main() io {
  var s = numbers()
  var more = true
  while more {
    match s.pull() {
      Pulled.Item(v) => print("item {v}")
      Pulled.Failed(e) => more = false
      Pulled.End => more = false
      Pulled.Timeout => more = false
    }
  }
  print("end")
}
Вывод
item 1
item 2
end
pub(api) enum Pulled<T, E>

С версии. 1.0.0-beta

Варианты

Item(value: T)

The next element.

Failed(error: E)

The stream ended with this error (no more pulls produce anything).

End

The stream ended normally.

Timeout

pullWithin: nothing arrived in time; the stream is still open and the next pull goes on waiting.

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

См. также