OxL Reference

method List.iter

Lazy iterator over a snapshot of the list (D-2001): later changes to the list are not seen and the iterator holds no borrow, so it may be returned or stored.

Example:

oxl✓ checked in CI
fn main() io {
  var xs = [1, 2, 3]
  let it = xs.iter()
  xs.push(4)
  print("{it.count()} {xs.len()}")
}
Output
3 4
pub(api) fn iter() -> iter<T>

Complexity. O(n): the iterator works on a snapshot.

Since. 1.0.0-beta

Returns

iter<T>

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/iter.oxl:814

See also