Expand description
Seekable Iterator
§Traits
Provides:
SeekableIterator
,SeekableLendingIterator
, andSeekablePooledIterator
traits, for circular iterators that can move backwards or forwards and seek.PooledIterator
trait, for iterators that would normally be a lending iterator, but use a buffer pool to lend out multiple items at the same time.CursorIterator
,CursorLendingIterator
, andCursorPooledIterator
traits, for circular iterators that can move backwards or forwards by one element.Seekable
trait, with all the seeking methods required by theSeekable*Iterator
traits.Comparator
trait, for comparisons done to seek.
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
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
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.
Structs§
- Default
Comparator - A
Comparator
which uses keys’Ord
implementations. - OutOf
Buffers - An error that may be returned if no buffer pools were available in a
PooledIterator
, instead of waiting for a buffer to become available.
Traits§
- Comparator
- Interface for comparing keys (or entries) of a sorted collection.
- Cursor
Iterator - A
CursorIterator
provides access to the entries of some sorted collection, and can move its current position in either direction. - Cursor
Lending Iterator - A
CursorLendingIterator
provides access to the entries of some sorted collection, and can move its current position in either direction. - Cursor
Pooled Iterator - A
CursorPooledIterator
provides access to the entries of some sorted collection, and can move its current position in either direction. - Lend
Item - Trait for getting the item of a lending iterator.
- Pooled
Iterator - A
PooledIterator
is similar to a lending iterator (which can lend one item at a time), but can make use of a buffer pool to lend out multiple items at a time. - Seekable
- A trait adding seek functionality to one of the cursor iterator traits.
- Seekable
Iterator - An
Iterator
with cursor methods fromCursorIterator
and the ability to seek fromSeekable
. - Seekable
Lending Iterator - A lending iterator with cursor methods from
CursorLendingIterator
and the ability to seek fromSeekable
. - Seekable
Pooled Iterator - A
PooledIterator
with cursor methods fromCursorPooledIterator
and the ability to seek fromSeekable
.
Type Aliases§
- Lent
Item - The item of a lending iterator, with a particular lifetime.