seekable-iterator

Crates.ioseekable-iterator
lib.rsseekable-iterator
version0.3.1
created_at2025-08-12 11:45:18.960582+00
updated_at2025-08-12 19:24:58.197323+00
descriptionTraits for iterators and lending iterators with seeking capabilities
homepage
repositoryhttps://github.com/robofinch/seekable-iterator
max_upload_size
id1791868
size67,045
(robofinch)

documentation

README

Seekable Iterator

github Latest version Documentation Apache 2.0 or MIT license.

Traits

Provides:

Adapters to lender::Lender and lending_iterator::LendingIterator are provided for the lending iterator trait.

Semantics

The PooledIterator trait makes roughly the same semantic assumptions about the iterator as a normal iterator.

However, the Cursor*Iterator and Seekable*Iterator traits assume that an implementor is a circular iterator over some ordered collection; the iterator is made circular by adding a phantom element before the first element and after the last element of the ordered collection. The iterator is thus not a FusedIterator, as after iteration over the collection is completed, the iterator wraps back around to the start.

The PooledIterator and Cursor*Iterator traits do not expose any comparator that the ordered collection and iterator might be using, but the Seekable and Seekable*Iterator traits do expose it via a Comparator generic. A DefaultComparator struct is provided that can compare keys that implement Ord, using their Ord implementation.

License

Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 0

cargo fmt