Skip to main content

Cursor

Trait Cursor 

Source
pub trait Cursor<'s> {
    type Item<'k>
       where Self: 'k;
    type Key: ?Sized;
    type ValueCursor: Cursor<'s>;

    // Required methods
    fn keys(&self) -> usize;
    fn item(&self) -> Self::Item<'_>;
    fn values(&self) -> Self::ValueCursor;
    fn step(&mut self);
    fn step_reverse(&mut self);
    fn seek(&mut self, key: &Self::Key);
    fn seek_reverse(&mut self, key: &Self::Key);
    fn valid(&self) -> bool;
    fn rewind(&mut self);
    fn fast_forward(&mut self);
    fn position(&self) -> usize;
    fn reposition(&mut self, lower: usize, upper: usize);
}
Expand description

A type supporting navigation.

The precise meaning of this navigation is not defined by the trait. It is likely that having navigated around, the cursor will be different in some other way, but the Cursor trait does not explain how this is so.

Required Associated Types§

Source

type Item<'k> where Self: 'k

The type revealed by the cursor.

Source

type Key: ?Sized

Key used to search the contents of the cursor.

Source

type ValueCursor: Cursor<'s>

Required Methods§

Source

fn keys(&self) -> usize

Source

fn item(&self) -> Self::Item<'_>

Reveals the current item.

Source

fn values(&self) -> Self::ValueCursor

Returns cursor over values associted with the current key.

Source

fn step(&mut self)

Advances the cursor by one element.

Source

fn step_reverse(&mut self)

Move cursor back by one element.

Source

fn seek(&mut self, key: &Self::Key)

Advances the cursor until the location where key would be expected.

Source

fn seek_reverse(&mut self, key: &Self::Key)

Move the cursor back until the location where key would be expected.

Source

fn valid(&self) -> bool

Returns true if the cursor points at valid data. Returns false if the cursor is exhausted.

Source

fn rewind(&mut self)

Rewinds the cursor to its initial state.

Source

fn fast_forward(&mut self)

Moves the cursor to the last position.

Source

fn position(&self) -> usize

Current position of the cursor.

Source

fn reposition(&mut self, lower: usize, upper: usize)

Repositions the cursor to a different range of values.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Cursor<'_> for ()

Source§

type Key = ()

Source§

type Item<'k> = &'k ()

Source§

type ValueCursor = ()

Source§

fn keys(&self) -> usize

Source§

fn item(&self) -> Self::Item<'_>

Source§

fn values(&self)

Source§

fn step(&mut self)

Source§

fn seek(&mut self, _key: &Self::Key)

Source§

fn valid(&self) -> bool

Source§

fn rewind(&mut self)

Source§

fn position(&self) -> usize

Source§

fn reposition(&mut self, _lower: usize, _upper: usize)

Source§

fn step_reverse(&mut self)

Source§

fn seek_reverse(&mut self, _key: &Self::Key)

Source§

fn fast_forward(&mut self)

Implementors§

Source§

impl<'s, K, L, O> Cursor<'s> for LayerCursor<'s, K, L, O>
where K: DataTrait + ?Sized, L: Trie, O: OrdOffset,

Source§

type Key = K

Source§

type Item<'k> = &'k K where Self: 'k

Source§

type ValueCursor = <L as Trie>::Cursor<'s>

Source§

impl<'s, K: DataTrait + ?Sized, R: WeightTrait + ?Sized> Cursor<'s> for LeafCursor<'s, K, R>

Source§

type Item<'k> = (&'k K, &'k R) where Self: 'k

Source§

type Key = K

Source§

type ValueCursor = ()