Seekable

Trait Seekable 

Source
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§

Source

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).

Source

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).

Source

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.

Source

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().

Source

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§

Source§

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>,

Available on crate feature anchored-pool only.
Source§

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>,

Available on crate feature anchored-pool only.
Source§

impl<Key, Cmp, I> Seekable<Key, Cmp> for LenderAdapter<I>
where Key: ?Sized, Cmp: ?Sized + Comparator<Key>, I: Seekable<Key, Cmp>,

Available on crate feature lender only.
Source§

impl<Key, Cmp, I> Seekable<Key, Cmp> for LendingIteratorAdapter<I>
where Key: ?Sized, Cmp: ?Sized + Comparator<Key>, I: Seekable<Key, Cmp>,

Available on crate feature lending-iterator only.
Source§

impl<Key, Cmp, I> Seekable<Key, Cmp> for PooledLenderAdapter<I>
where Key: ?Sized, Cmp: ?Sized + Comparator<Key>, I: Seekable<Key, Cmp> + PooledIterator,

Available on crate feature lender only.
Source§

impl<Key, Cmp, I> Seekable<Key, Cmp> for PooledLendingIteratorAdapter<I>
where Key: ?Sized, Cmp: ?Sized + Comparator<Key>, I: Seekable<Key, Cmp> + PooledIterator,

Available on crate feature lending-iterator only.
Source§

impl<Key, Cmp, Iter> Seekable<Key, Cmp> for MergingIter<Key, Cmp, Iter>
where Key: ?Sized, Cmp: Comparator<Key>, Iter: SeekableLendingIterator<Key, Cmp> + ItemToKey<Key>,

Available on crate feature alloc only.