Expand description
This crate provides EternalIterator, which promises that the iterator
iterates forever.
This crate is compatible with core::iter. So you can use methods in
core::iter to generate iterators.
let mut it = core::iter::repeat(123_i32).map(|i| i * 2)
.enumerate().skip(5).step_by(2).zip(core::iter::once(3).chain(10..));
assert_eq!(it.next_eternal(), ((5, 246), 3));
assert_eq!(it.next_eternal(), ((7, 246), 10));
assert_eq!(it.next(), Some(((9, 246), 11)));
assert_eq!(it.next_eternal(), ((11, 246), 12));Modules§
Structs§
- FromFn
- It is used on the implementation of
from_fn(). Seefrom_fn()document for details. - Successors
- It is used on the implementation of
successors(). Seesuccessors()document for details. - Unsafe
Wrapper - It is used on the implementation of
wrap_unsafe(). Seewrap_unsafe()document for details.
Traits§
- Eternal
Iterator - Like
Iterator, but promises that the iterator iterates forever.
Functions§
- from_fn
- Creates a new iterator where each iteration calls the provided closure
F: FnMut() -> T. - successors
- Creates a new iterator where each successive item is computed based on the preceding one.
- wrap
- Safe version of
wrap_unsafe() - wrap_
unsafe ⚠ - Wraps
Iteratorto be seen asEternalIterator.