OxL Reference

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✓ checked in 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")
    }
  }
}
Output
value 1
the stream failed
pub(api) move fn results() -> stream<T | E>

Since. 1.0.0-beta

Returns

stream<T | E>

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/stream.oxl:261

See also