fastpeek

Crates.iofastpeek
lib.rsfastpeek
version0.2.6
sourcesrc
created_at2024-09-26 09:21:11.782433
updated_at2024-09-30 11:04:19.387029
descriptionA different way to peek iterators
homepage
repositoryhttps://github.com/grelner/fastpeek
max_upload_size
id1387257
size29,173
Christian Schjølberg (grelner)

documentation

README

fastpeek rust-version-badge

When you need to do fast iteration, std::iter::Peekable adds some overhead because it has to check if it has a buffered value on each call to next(). This crate provides tree simple traits that can be implemented for iterators where the aim is to peek without calling next(). In addition to a normal single value forward peek, the crate has traits for peeking a DoubleEndedIterator, and for peeking multiple values through an iterator.

The crate does not necessarily aim to make peeking faster, but to remove the overhead of std::iter::Peekable when doing normal iteration.

The crate contains implementations for all Iterators that implement AsRef<[T]> plus std::array::IntoIter. In addition, Iterator adapters using various strategies to provide Peek are provided.

Commit count: 21

cargo fmt