pub trait Seekable<Key: ?Sized, Cmp: ?Sized + Comparator<Key>> {
// Required methods
fn reset(&mut self);
fn seek(&mut self, min_bound: &Key);
fn seek_before(&mut self, strict_upper_bound: &Key);
fn seek_to_first(&mut self);
fn seek_to_last(&mut self);
}Expand description
A trait adding seek functionality to one of the cursor iterator traits.
See CursorIterator, CursorLendingIterator, or CursorPooledIterator for more.
Additionally, the keys of implementors must be sorted by a comparator of the indicated
Comparator type.
Implementors of Seekable and CursorLendingIterator should strongly consider implementing
ItemToKey as well.
Required Methods§
Sourcefn reset(&mut self)
fn reset(&mut self)
Reset the iterator to its initial position, before the first entry and after the last entry (if there are any entries in the collection).
The iterator becomes !valid(), and is conceptually one position before the first entry
and one position after the last entry (if there are any entries in the collection).
Sourcefn seek(&mut self, min_bound: &Key)
fn seek(&mut self, min_bound: &Key)
Move the iterator to the smallest key which is greater or equal than the provided
min_bound.
If there is no such key, the iterator becomes !valid(), and is conceptually
one position before the first entry and one position after the last entry (if there are
any entries in the collection).
Sourcefn seek_before(&mut self, strict_upper_bound: &Key)
fn seek_before(&mut self, strict_upper_bound: &Key)
Move the iterator to the greatest key which is strictly less than the provided
strict_upper_bound.
If there is no such key, the iterator becomes !valid(), and is conceptually
one position before the first entry and one position after the last entry (if there are
any entries in the collection).
Some implementations may have worse performance for seek_before than seek.
Sourcefn seek_to_first(&mut self)
fn seek_to_first(&mut self)
Move the iterator to the smallest key in the collection.
If the collection is empty, the iterator is !valid().
Sourcefn seek_to_last(&mut self)
fn seek_to_last(&mut self)
Move the iterator to the greatest key in the collection.
If the collection is empty, the iterator is !valid().
Implementors§
impl<I, BorrowedItem, Key, Cmp> Seekable<Key, Cmp> for PooledIter<I, BorrowedItem>where
I: CursorLendingIterator + Seekable<Key, Cmp>,
BorrowedItem: ToOwned,
Key: ?Sized,
Cmp: Comparator<Key>,
for<'lend> LentItem<'lend, I>: Borrow<BorrowedItem>,
anchored-pool only.impl<I, BorrowedItem, Key, Cmp> Seekable<Key, Cmp> for ThreadsafePooledIter<I, BorrowedItem>where
I: CursorLendingIterator + Seekable<Key, Cmp>,
BorrowedItem: ToOwned,
Key: ?Sized,
Cmp: Comparator<Key>,
for<'lend> LentItem<'lend, I>: Borrow<BorrowedItem>,
anchored-pool only.impl<Key, Cmp, I> Seekable<Key, Cmp> for LenderAdapter<I>
lender only.impl<Key, Cmp, I> Seekable<Key, Cmp> for LendingIteratorAdapter<I>
lending-iterator only.impl<Key, Cmp, I> Seekable<Key, Cmp> for PooledLenderAdapter<I>
lender only.impl<Key, Cmp, I> Seekable<Key, Cmp> for PooledLendingIteratorAdapter<I>
lending-iterator only.impl<Key, Cmp, Iter> Seekable<Key, Cmp> for MergingIter<Key, Cmp, Iter>
alloc only.