OxL Reference

method stream.withOffsets

Every element with its offset: (offset, element) (§10.3, D-3600).

Example:

oxl✓ checked in CI
fn numbers() -> stream<str> {
  yield "a"
  yield "b"
}

fn main() io {
  for await (n, x) in numbers().withOffsets() {
    print("{n}: {x}")
  }
}
Output
0: a
1: b
pub(api) move fn withOffsets() -> stream<(u64, T), E>

Since. 1.0.0-beta

Returns

stream<(u64, T), E>

Effects

none declared (pure unless the body says otherwise)

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

See also