logos.lang.iter
Module lang · package logos-lang
Traits
traitDoubleEndedIterator
trait DoubleEndedIterator
Extends Iterator with consumption from the back; the two ends never yield the same item.
Implemented by: RevIter CopiedIter MapIter FuseIter FilterMapIter FilterIter TakeIter SkipIter InspectIter PeekableIter OnceIter OptionIter EmptyIter EnumIter ChainIter ZipIter SliceIter RangeI32 RangeI64 VecIter VecIntoIter
traitExactSizeIterator
trait ExactSizeIterator
Extends Iterator with an exact remaining-item count.
Implemented by: CopiedIter TakeIter SkipIter EnumIter ZipIter SliceIter ArrayIntoIter RangeI32 RangeI64 VecIter VecIntoIter
traitFromIterator
trait FromIterator
Builds Self from an iterator of A values; the dispatch target of Iterator::collect.
traitFusedIterator
trait FusedIterator
Marks an iterator that keeps returning None forever after its first None.
Implemented by: FuseIter OnceIter EmptyIter ArrayIntoIter RangeI32 RevRangeI32 RangeI64 RevRangeI64 RangeFromI32 RangeFromI64 RangeInclI32 RangeInclI64
traitIntoIterator
trait IntoIterator
Converts a value into an iterator over its items; for x in expr desugars through this.
traitIterator
trait Iterator
Yields a sequence of Item values one at a time; the core protocol of std.iter.
Implemented by: RevIter CopiedIter MapIter FilterIter ScanIter FuseIter FilterMapIter TakeIter SkipIter TakeWhileIter SkipWhileIter StepByIter InspectIter PeekableIter IntersperseIter FlattenIter ArrayChunksIter MapWindowsIter FlatMapIter ByRefIter OnceIter OptionIter ResultIter EmptyIter RepeatIter CycleIter EnumIter ChainIter ZipIter SliceIter FromFnIter SuccessorsIter RepeatNIter OnceWithIter RepeatWithIter Splitter ByteSplitter SplitPat Chars CharIndices Bytes Lines Utf8Chunks Matches MatchIndices ArrayIntoIter RangeOf RangeOfIncl RangeOfFrom RangeI32 RevRangeI32 RangeI64 RevRangeI64 RangeFromI32 RangeFromI64 RangeInclI32 RangeInclI64 Chunks Windows VecIter VecIntoIter VecIterMut HashMapIter HashMapKeys HashMapValues ReadDir LineReader HashSetIter BTreeMapIter
traitProduct
trait Product
Folds an iterator of A into Self by multiplication; dispatch target of Iterator::product.
Implemented by: i32 i64 i32 i64
traitSum
trait Sum
Folds an iterator of A into Self by addition; the dispatch target of Iterator::sum.
Implemented by: i32 i64 i32 i64
Types
structArrayChunksIter
struct ArrayChunksIter
Chunking adapter grouping items into [T; N] arrays; a trailing partial chunk is dropped.
Implements: Iterator
Fields
_t: T
Phantom anchor for T; value unused.
buf: [T; 0]
Accumulation buffer for the chunk in progress.
inner: I
Source iterator.
structByRefIter
struct ByRefIter
Borrowing wrapper forwarding next to *p, so the original iterator keeps its position.
Implements: Iterator
Fields
_t: T
Phantom anchor for T; value unused.
p: *mut I
Raw pointer to the borrowed source iterator.
structChainIter
struct ChainIter
Concatenating adapter: yields all of first, then all of second.
Implements: Iterator DoubleEndedIterator
Fields
first: A
First source, drained before second.
first_done: bool
Set once first is exhausted from the front.
second: B
Second source.
structCopiedIter
struct CopiedIter
By-ref bridge: copies each &T yielded by inner into an owned T.
Implements: Iterator DoubleEndedIterator ExactSizeIterator
Fields
_t_marker: i32
Phantom anchor for T (zero-sized stand-in); value unused.
inner: I
Underlying by-ref iterator.
structCycleIter
struct CycleIter
Repeating adapter: when active exhausts, re-clones orig and continues forever.
An empty source just keeps yielding None (no infinite loop).
Implements: Iterator
Fields
_t: T
Phantom anchor for T; value unused.
active: I
Currently-draining copy.
orig: I
Pristine copy the cycle re-clones from.
structEmptyIter
struct EmptyIter
Always-empty source: every next returns None.
Implements: Iterator DoubleEndedIterator FusedIterator
Fields
_t: T
structEnumIter
struct EnumIter
Enumerating adapter pairing each item with its zero-based index.
Implements: Iterator DoubleEndedIterator ExactSizeIterator
Fields
idx: i64
Index the next front item will receive.
inner: I
Source iterator.
structEnumPair
struct EnumPair
Index/value pair yielded by EnumIter.
Fields
idx: i64
Zero-based position of val in the source sequence.
val: T
The item itself.
structFilterIter
struct FilterIter
Lazy filter adapter yielding only items for which pred returns true.
Implements: Iterator DoubleEndedIterator
Fields
inner: I
Source iterator.
pred: fn(T) -> bool
Predicate selecting the yielded items.
structFilterMapIter
struct FilterMapIter
Combined filter+map adapter: yields b where f returns Some(b), skips None results.
Implements: Iterator DoubleEndedIterator
Fields
f: fn(T) -> Option
Mapper; items it maps to None are skipped.
inner: I
Source iterator.
structFlatMapIter
struct FlatMapIter
Map-then-flatten adapter: f maps each outer item to an iterator whose elements are yielded.
Implements: Iterator
Fields
_t: T
Phantom anchor for T; value unused.
_u: U
Phantom anchor for U; value unused.
cur: II
Currently-draining inner iterator.
f: F
Mapper producing an inner iterator per outer item.
has_cur: bool
True when cur holds a live inner iterator.
outer: I
Outer source iterator.
structFlattenIter
struct FlattenIter
Flattening adapter: yields the elements of each inner iterator produced by outer, in order.
Implements: Iterator
Fields
cur: I
Currently-draining inner iterator.
has_cur: bool
True when cur holds a live inner iterator.
outer: O
Outer iterator producing inner iterators.
structFromFnIter
struct FromFnIter
Closure-driven source: each next returns f().
Implements: Iterator
Fields
f: fn() -> Option
Generator invoked once per next.
structFuseIter
struct FuseIter
Fusing adapter: after the source first returns None, every later call returns None.
Implements: Iterator FusedIterator DoubleEndedIterator
Fields
_t: T
Phantom anchor for T; value unused.
done: bool
Set at the first None from the source.
inner: I
Source iterator.
structInspectIter
struct InspectIter
Pass-through adapter calling visit on a copy of each item.
Implements: Iterator DoubleEndedIterator
Fields
_t: T
Phantom anchor for T; value unused.
inner: I
Source iterator.
visit: fn(T) -> void
Observer invoked per item.
structIntersperseIter
struct IntersperseIter
Separating adapter: yields a, sep, b, sep, c, …; empty/single sources emit no separator.
Implements: Iterator
Fields
emit_sep: bool
True when the next yield must be the separator.
has_peeked: bool
True when peeked_val holds a queued item.
inner: I
Source iterator.
peeked_val: T
One-item lookahead buffer (two-state form; see note above).
sep: T
Separator re-emitted (by raw copy) between consecutive items.
structMapIter
struct MapIter
Lazy map adapter applying f to each item of inner.
Implements: Iterator DoubleEndedIterator
Fields
f: F
Mapper invoked per item.
inner: I
Source iterator.
structMapWindowsIter
struct MapWindowsIter
Sliding-window adapter yielding f over each length-N window of the source.
Yields nothing if the source has fewer than N items.
Implements: Iterator
Fields
_r: R
Phantom anchor for R; value unused.
_t: T
Phantom anchor for T; value unused.
buf: [T; 0]
Current window contents.
f: F
Mapper applied to a copy of each window.
inner: I
Source iterator.
primed: bool
True once the initial N-item fill has happened.
structOnceIter
struct OnceIter
Single-item source: yields val once, then None forever.
Implements: Iterator FusedIterator DoubleEndedIterator
Fields
consumed: bool
Set after the single yield.
val: T
Value copied out on the first next.
structOnceWithIter
struct OnceWithIter
Single-shot generator source: f fires exactly once, on the first next.
Implements: Iterator
Fields
_t: T
Phantom anchor for T; value unused.
f: F
Generator invoked on the first next.
fired: bool
Set after the single yield.
structOptionIter
struct OptionIter
0-or-1-item source over an Option<T>; backs IntoIterator for Option.
Implements: Iterator DoubleEndedIterator
Fields
state: Option
Remaining item, taken by the first next.
structPeekableIter
struct PeekableIter
One-item-lookahead wrapper: peek caches the next item without consuming it.
Implements: Iterator DoubleEndedIterator
Fields
inner: I
Source iterator.
peeked: Option
Cached lookahead item; None when the cache is empty.
structRepeatIter
struct RepeatIter
Infinite source yielding a copy of val on every next.
Implements: Iterator
Fields
val: T
structRepeatNIter
struct RepeatNIter
Bounded repeat source: yields value exactly count times.
Implements: Iterator
Fields
count: i64
Remaining number of yields.
value: T
Value copied out on each yield.
structRepeatWithIter
struct RepeatWithIter
Infinite generator source: calls f on every next, never returns None.
Implements: Iterator
Fields
_t: T
Phantom anchor for T; value unused.
f: F
Generator invoked once per next.
structResultIter
struct ResultIter
0-or-1-item source over a Result’s Ok value; an Err yields nothing (error dropped).
Implements: Iterator
Fields
state: Option
Remaining item, taken by the first next.
structRevIter
struct RevIter
Reversing adapter over a DoubleEndedIterator: next pulls from the source’s back.
Implements: Iterator DoubleEndedIterator
Fields
_t_marker: i32
Phantom anchor for T (zero-sized stand-in); value unused.
inner: I
Underlying double-ended iterator.
structScanIter
struct ScanIter
Stateful map adapter: f mutates state per item and yields its Option<B> result.
Implements: Iterator
Fields
f: fn(&mut St, T) -> Option
Step function; its None results surface directly.
inner: I
Source iterator.
state: St
Mutable state threaded through f.
structSkipIter
struct SkipIter
Skipping adapter: drops the first remaining items, then yields the rest.
Implements: Iterator DoubleEndedIterator ExactSizeIterator
Fields
inner: I
Source iterator.
remaining: i64
Number of items still to drop.
structSkipWhileIter
struct SkipWhileIter
Adapter dropping the longest prefix satisfying pred, then yielding everything after.
Implements: Iterator
Fields
_t: T
Phantom anchor for T; value unused.
inner: I
Source iterator.
pred: fn(T) -> bool
Predicate selecting the dropped prefix.
primed: bool
Set once the prefix has been dropped.
structSliceIter
struct SliceIter
Borrowing iterator over a slice, yielding &T; double-ended via distinct front/back cursors.
Implements: Iterator DoubleEndedIterator ExactSizeIterator
Fields
back_idx: i64
data: *const T
idx: i64
len: i64
structStepByIter
struct StepByIter
Striding adapter yielding the first item, then every step-th item after it.
Implements: Iterator
Fields
_t: T
Phantom anchor for T; value unused.
first: bool
True until the first item has been yielded.
inner: I
Source iterator.
step: i64
Stride between yielded items.
structSuccessorsIter
struct SuccessorsIter
Unfolding source: yields the pending value, then advances it via succ.
Implements: Iterator
Fields
next_val: Option
Value the next next call will yield; None = exhausted.
succ: F
Successor function producing the follow-up value.
structTakeIter
struct TakeIter
Truncating adapter yielding at most remaining more items.
Implements: Iterator DoubleEndedIterator ExactSizeIterator
Fields
inner: I
Source iterator.
remaining: i64
Number of items still allowed through.
structTakeWhileIter
struct TakeWhileIter
Prefix adapter: yields items while pred holds; the failing item is consumed and dropped.
Implements: Iterator
Fields
_t: T
Phantom anchor for T; value unused.
done: bool
Set once pred has failed; the adapter stays exhausted.
inner: I
Source iterator.
pred: fn(T) -> bool
Predicate gating each item.
structZipIter
struct ZipIter
Pairing adapter yielding ZipPairs until either side exhausts.
A left item pulled when the right side is already exhausted is dropped.
Implements: Iterator DoubleEndedIterator ExactSizeIterator
Fields
left: A
Left source.
right: B
Right source.
structZipPair
struct ZipPair
Item pair yielded by ZipIter.
Fields
first: A
Item pulled from the left iterator.
second: B
Item pulled from the right iterator.
Functions
fniter_array_chunks
fn iter_array_chunks(iter: I, zero_buf: [T; 0], anchor: T) -> ArrayChunksIter<I, T, N>
Creates an ArrayChunksIter; zero_buf and anchor are placeholder initialisers.
fniter_by_ref
fn iter_by_ref(it: &mut I) -> ByRefIter<I, T>
Creates a ByRefIter borrowing it; chained adapters then don’t consume the original.
Raw-pointer backed — the wrapper must not outlive it.
fniter_chain
fn iter_chain(a: A, b: B, _zero: T) -> ChainIter<A, B, T>
Creates a ChainIter yielding a then b; _zero only anchors T inference.
fniter_cmp
fn iter_cmp(a: I, b: J) -> Ordering
Compares two iterators lexicographically; a shorter matching prefix compares Less.
fniter_copied
fn iter_copied(iter: I) -> CopiedIter<I, T>
Creates a CopiedIter over a by-ref iterator; free-fn form of Rust’s .copied().
fniter_count
fn iter_count(iter: I) -> i64
Consumes iter, returning the number of items; free-fn form of Iterator::count.
fniter_cycle
fn iter_cycle(iter: I, zero: T) -> CycleIter<I, T>
Creates a CycleIter repeating iter endlessly; zero fills the phantom field.
fniter_empty
fn iter_empty(zero: T) -> EmptyIter<T>
Creates an iterator yielding nothing; zero fills the phantom field.
fniter_enumerate
fn iter_enumerate(iter: I, _zero: T) -> EnumIter<I, T>
Creates an EnumIter over iter; _zero only anchors T inference.
fniter_eq
fn iter_eq(a: I, b: J) -> bool
Returns true iff both iterators yield the same number of items and all pairs compare equal.
fniter_eq_by
fn iter_eq_by(a: I, b: J, eq: fn(T, U) -> bool) -> bool
Returns true iff both iterators yield the same number of items and eq(x, y) holds pairwise.
fniter_filter
fn iter_filter(iter: I, pred: fn(T) -> bool) -> FilterIter<I, T>
Creates a FilterIter yielding the items of iter that satisfy pred.
fniter_filter_map
fn iter_filter_map(iter: I, f: fn(T) -> Option) -> FilterMapIter<I, T, B>
Creates a FilterMapIter applying f and skipping items mapped to None.
fniter_flat_map
fn iter_flat_map(iter: I, f: F, zero_t: T, zero_inner: II, zero_u: U) -> FlatMapIter<I, T, F, II, U>
Creates a FlatMapIter; the zero_* args are placeholder initialisers, never yielded.
fniter_flatten
fn iter_flatten(outer: O, zero_inner: I) -> FlattenIter<O, I, T>
Creates a FlattenIter over outer; zero_inner seeds the inactive cur slot.
fniter_fold
fn iter_fold(iter: I, init: B, f: F) -> B
Folds every item into an accumulator starting from init; free-fn form of Iterator::fold.
fniter_for_each
fn iter_for_each(iter: I, f: F) -> void
Calls f on each item, consuming iter; free-fn form of Iterator::for_each.
fniter_from_fn
fn iter_from_fn(f: fn() -> Option) -> FromFnIter<T>
Creates an iterator that calls f on every next; f returning None ends iteration.
fniter_fuse
fn iter_fuse(iter: I, zero: T) -> FuseIter<I, T>
Creates a FuseIter over iter; zero fills the phantom field and is never yielded.
fniter_ge
fn iter_ge(a: I, b: J) -> bool
Returns true iff a is lexicographically greater than or equal to b.
fniter_gt
fn iter_gt(a: I, b: J) -> bool
Returns true iff a is lexicographically greater than b.
fniter_inspect
fn iter_inspect(iter: I, visit: fn(T) -> void, zero: T) -> InspectIter<I, T>
Creates an InspectIter calling visit per item; zero fills the phantom field.
fniter_intersperse
fn iter_intersperse(iter: I, sep: T, zero: T) -> IntersperseIter<I, T>
Creates an IntersperseIter with separator sep; zero seeds the peek buffer.
fniter_le
fn iter_le(a: I, b: J) -> bool
Returns true iff a is lexicographically less than or equal to b.
fniter_lt
fn iter_lt(a: I, b: J) -> bool
Returns true iff a is lexicographically less than b.
fniter_map
fn iter_map(iter: I, f: F) -> MapIter<I, T, R, F>
Creates a MapIter applying f to each item of iter; free-fn form of Iterator::map.
fniter_map_windows
fn iter_map_windows(iter: I, f: F, zero_buf: [T; 0], anchor: T, zero_r: R) -> MapWindowsIter<I, T, R, F, N>
Creates a MapWindowsIter; the zero_*/anchor args are placeholder initialisers.
fniter_max
fn iter_max(iter: I) -> Option
Returns the maximum item, or None if empty; of equal maxima the last is kept (Rust).
fniter_max_by
fn iter_max_by(iter: I, cmp: fn(T, T) -> i32) -> Option
Returns the comparator-maximal item, or None if empty; the last of equals wins (Rust).
fniter_max_by_key
fn iter_max_by_key(iter: I, key: fn(T) -> K) -> Option
Returns the item whose key projection is maximal, or None if empty; last of equals wins (Rust).
fniter_max_i32
fn iter_max_i32(iter: I) -> Option
Returns the largest i32 item, or None if empty.
fniter_max_i64
fn iter_max_i64(iter: I) -> Option
Returns the largest i64 item, or None if empty.
fniter_min
fn iter_min(iter: I) -> Option
Returns the minimum item, or None if empty; of equal minima the first is kept.
fniter_min_by
fn iter_min_by(iter: I, cmp: fn(T, T) -> i32) -> Option
Returns the comparator-minimal item, or None if empty; the first of equals wins.
fniter_min_by_key
fn iter_min_by_key(iter: I, key: fn(T) -> K) -> Option
Returns the item whose key projection is minimal, or None if empty; first of equals wins.
fniter_min_i32
fn iter_min_i32(iter: I) -> Option
Returns the smallest i32 item, or None if empty.
fniter_min_i64
fn iter_min_i64(iter: I) -> Option
Returns the smallest i64 item, or None if empty.
fniter_ne
fn iter_ne(a: I, b: J) -> bool
Returns true iff the two iterators are not pairwise equal.
fniter_once
fn iter_once(val: T) -> OnceIter<T>
Creates an iterator yielding val exactly once.
fniter_once_with
fn iter_once_with(f: F, zero: T) -> OnceWithIter<T, F>
Creates an iterator firing f once on the first next; zero fills the phantom field.
fniter_over_slice
fn iter_over_slice(s: &[T]) -> SliceIter<T>
Creates a SliceIter borrowing s.
Holds a raw pointer into the slice — the iterator must not outlive s.
fniter_peekable
fn iter_peekable(iter: I, _zero: T) -> PeekableIter<I, T>
Creates a PeekableIter over iter; _zero only anchors T inference.
fniter_product_i32
fn iter_product_i32(iter: I) -> i32
Multiplies all i32 items; an empty iterator yields 1.
fniter_product_i64
fn iter_product_i64(iter: I) -> i64
Multiplies all i64 items; an empty iterator yields 1.
fniter_repeat
fn iter_repeat(val: T) -> RepeatIter<T>
Creates an infinite iterator repeating val.
fniter_repeat_n
fn iter_repeat_n(value: T, count: i64) -> RepeatNIter<T>
Creates an iterator yielding value exactly count times; count <= 0 yields nothing.
fniter_repeat_with
fn iter_repeat_with(f: F, zero: T) -> RepeatWithIter<T, F>
Creates an infinite iterator calling f on every next; zero fills the phantom field.
fniter_rev
fn iter_rev(iter: I) -> RevIter<I, T>
Creates a RevIter over iter; free-fn form of DoubleEndedIterator::rev.
fniter_rposition
fn iter_rposition(iter: I, pred: fn(T) -> bool) -> Option
Returns the forward index of the first back-to-front item satisfying pred, or None.
Needs DEI + ExactSize to translate the back position into a front-relative index.
fniter_scan
fn iter_scan(iter: I, state: St, f: fn(&mut St, T) -> Option) -> ScanIter<I, T, St, B>
Creates a ScanIter with initial state, applying f to each item.
fniter_skip
fn iter_skip(iter: I, n: i64, _zero: T) -> SkipIter<I, T>
Creates a SkipIter dropping the first n items of iter; _zero only anchors T.
fniter_skip_while
fn iter_skip_while(iter: I, pred: fn(T) -> bool, zero: T) -> SkipWhileIter<I, T>
Creates a SkipWhileIter; zero fills the phantom field and is never yielded.
fniter_step_by
fn iter_step_by(iter: I, step: i64, zero: T) -> StepByIter<I, T>
Creates a StepByIter with stride step; zero fills the phantom field.
fniter_successors
fn iter_successors(first: Option, succ: F) -> SuccessorsIter<T, F>
Creates an iterator yielding first, then successive succ results until one is None.
fniter_sum_i32
fn iter_sum_i32(iter: I) -> i32
Sums all i32 items; an empty iterator yields 0.
fniter_sum_i64
fn iter_sum_i64(iter: I) -> i64
Sums all i64 items; an empty iterator yields 0.
fniter_take
fn iter_take(iter: I, n: i64, _zero: T) -> TakeIter<I, T>
Creates a TakeIter capping iter at n items; _zero only anchors T inference.
fniter_take_while
fn iter_take_while(iter: I, pred: fn(T) -> bool, zero: T) -> TakeWhileIter<I, T>
Creates a TakeWhileIter; zero fills the phantom field and is never yielded.
fniter_zip
fn iter_zip(a: A, b: B, _zt: T, _zu: U) -> ZipIter<A, B, T, U>
Creates a ZipIter over a and b; _zt/_zu only anchor T/U inference.
fnproduct
fn product(iter: I) -> i64
fnsum
fn sum(iter: I) -> i64