Iterator<T>

Iterator adapters are lazy and single-pass; terminals consume from the current cursor position.

Methods

fn iter() -> Iterator<T>adapter#

Creates a fresh array cursor, or returns the same iterator cursor without rewinding it.

fn next() -> Optional<T>terminal#

Advances once; fused iterators keep returning none after exhaustion.

fn map<U>(callback: fn(T) -> U) -> Iterator<U>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn map_indexed<U>(callback: fn(int, T) -> U) -> Iterator<U>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn filter(predicate: fn(T) -> bool) -> Iterator<T>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn filter_not(predicate: fn(T) -> bool) -> Iterator<T>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn filter_indexed(predicate: fn(int, T) -> bool) -> Iterator<T>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn filter_map<U>(callback: fn(T) -> Optional<U>) -> Iterator<U>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn map_not_none<U>(callback: fn(T) -> Optional<U>) -> Iterator<U>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn flat_map<U>(callback: fn(T) -> [U] | Iterator<U>) -> Iterator<U>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn inspect(callback: fn(T) -> void) -> Iterator<T>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn on_each(callback: fn(T) -> void) -> Iterator<T>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn running_fold<U>(initial: U, callback: fn(U, T) -> U) -> Iterator<U>adapter#

Includes the initial accumulator, then one value for every consumed item.

fn running_reduce(callback: fn(T, T) -> T) -> Iterator<T>adapter#

Yields each intermediate reduction and is empty for empty input.

fn take(count: int) -> Iterator<T>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn skip(count: int) -> Iterator<T>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn take_while(predicate: fn(T) -> bool) -> Iterator<T>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn skip_while(predicate: fn(T) -> bool) -> Iterator<T>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn take_last(count: int) -> Iterator<T>adapter#

Uses bounded buffering; negative counts clamp to zero.

fn drop_last(count: int) -> Iterator<T>adapter#

Uses bounded buffering; negative counts clamp to zero.

fn chunked(size: int) -> Iterator<[T]>adapter#

Produces snapshot arrays and includes a final short chunk; size must be positive.

fn windowed(size: int, step: int = 1, partial: bool = false) -> Iterator<[T]>adapter#

Produces non-aliasing sliding-window snapshots; size and step must be positive.

fn zip_with_next() -> Iterator<(T, T)>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn interleave(other: Iterator<T>) -> Iterator<T>adapter#

Alternates elements until both sources are exhausted.

fn enumerate() -> Iterator<(int, T)>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn zip<U>(other: Iterator<U>) -> Iterator<(T, U)>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn chain(other: Iterator<T>) -> Iterator<T>adapter#

Array receivers materialize a fresh result; iterator receivers create a lazy, single-pass adapter.

fn distinct() -> Iterator<T>adapter#

Retains first occurrences in input order; iterator state may grow without bound.

fn distinct_by<K>(selector: fn(T) -> K) -> Iterator<T>adapter#

Retains the first item for each selector key in input order.

fn collect() -> [T]terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn first_or_none() -> Optional<T>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn last_or_none() -> Optional<T>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn first_where(predicate: fn(T) -> bool) -> Optional<T>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn last_where(predicate: fn(T) -> bool) -> Optional<T>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn single_or_none() -> Optional<T>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn element_at_or_none(index: int) -> Optional<T>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn index_first(predicate: fn(T) -> bool) -> Optional<int>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn index_last(predicate: fn(T) -> bool) -> Optional<int>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn none(predicate: fn(T) -> bool) -> boolterminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn contains_all(values: [T]) -> boolterminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn partition(predicate: fn(T) -> bool) -> ([T], [T])terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn associate<K,V>(callback: fn(T) -> (K,V)) -> {K: V}terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn associate_by<K>(selector: fn(T) -> K) -> {K: T}terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn associate_with<V>(selector: fn(T) -> V) -> {T: V}terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn group_by<K>(selector: fn(T) -> K) -> {K: [T]}terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn group_map<K,V>(key: fn(T) -> K, value: fn(T) -> V) -> {K: [V]}terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn group_count<K>(selector: fn(T) -> K) -> {K: int}terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn sorted_by<K>(selector: fn(T) -> K) -> [T]terminal#

Stable; evaluates the selector exactly once per item.

fn sorted_by_desc<K>(selector: fn(T) -> K) -> [T]terminal#

Stable descending order; evaluates the selector exactly once per item.

fn min_by<K>(selector: fn(T) -> K) -> Optional<T>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn max_by<K>(selector: fn(T) -> K) -> Optional<T>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn sum_by<N>(selector: fn(T) -> N) -> Nterminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn average() -> Optional<float>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn average_by(selector: fn(T) -> number) -> Optional<float>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn count() -> intterminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn count_by(predicate: fn(T) -> bool) -> intterminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn fold<U>(initial: U, callback: fn(U, T) -> U) -> Uterminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn reduce(callback: fn(T, T) -> T) -> Optional<T>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn fold_indexed<U>(initial: U, callback: fn(int, U, T) -> U) -> Uterminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn reduce_indexed(callback: fn(int, T, T) -> T) -> Optional<T>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn any(predicate: fn(T) -> bool) -> boolterminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn all(predicate: fn(T) -> bool) -> boolterminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn find(predicate: fn(T) -> bool) -> Optional<T>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn position(predicate: fn(T) -> bool) -> Optional<int>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn for_each(callback: fn(T) -> void) -> voidterminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn sum() -> Tterminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn min() -> Optional<T>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn max() -> Optional<T>terminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.

fn join_to_string(sep: string, prefix: string = "", suffix: string = "", limit: int = -1, truncated: string = "...") -> stringterminal#

Consumes an iterator from its current cursor position; array receivers inspect the complete array.