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

method stream.results

The error of the stream as one more element: T | E, without propagation; after it the stream ends (§10.3).

Example:

oxl✓ проверяется в CI
@error data Broken {}

fn numbers() -> stream<i64, Broken> {
  yield 1
  fail Broken{}
}

fn main() io {
  for await r in numbers().results() {
    match r {
      i64 v => print("value {v}")
      Broken _ => print("the stream failed")
    }
  }
}
Вывод
value 1
the stream failed
pub(api) move fn results() -> stream<T | E>

С версии. 1.0.0-beta

Возвращает

stream<T | E>

Эффекты

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

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

См. также