pub struct Cursor<K: Key> { /* private fields */ }
Expand description
Cursor
points to a key value pair in the tree. Not like Iterator, it can move to next or prev.
Implementations§
Source§impl<'k, K: Key + 'k> Cursor<K>
impl<'k, K: Key + 'k> Cursor<K>
Sourcepub fn first<'b, S: NodeStore<K = K>>(
tree: &'b BPlusTree<S>,
) -> Option<(Self, &'b S::V)>where
'k: 'b,
pub fn first<'b, S: NodeStore<K = K>>(
tree: &'b BPlusTree<S>,
) -> Option<(Self, &'b S::V)>where
'k: 'b,
Create a Cursor
pointing to the first key-value pair in the tree.
Sourcepub fn last<'b, S: NodeStore<K = K>>(
tree: &'b BPlusTree<S>,
) -> Option<(Self, &'b S::V)>where
'k: 'b,
pub fn last<'b, S: NodeStore<K = K>>(
tree: &'b BPlusTree<S>,
) -> Option<(Self, &'b S::V)>where
'k: 'b,
Create a Cursor
pointing to the last key-value pair in the tree. If the key for self
is deleted, then
this returns the cursor for the key value pair just larger than the deleted key.
Sourcepub fn prev<'a, 'b, S: NodeStore<K = K>>(
&'a self,
tree: &'b BPlusTree<S>,
) -> Option<Self>
pub fn prev<'a, 'b, S: NodeStore<K = K>>( &'a self, tree: &'b BPlusTree<S>, ) -> Option<Self>
Get the Cursor
points to the prev key-value pair. If the key for self
is deleted, then
this returns the cursor for the key value pair just under the deleted key.
Sourcepub fn prev_with_value<'a, 'b, S: NodeStore<K = K>>(
&'a self,
tree: &'b BPlusTree<S>,
) -> Option<(Self, &'b S::V)>where
'k: 'b,
pub fn prev_with_value<'a, 'b, S: NodeStore<K = K>>(
&'a self,
tree: &'b BPlusTree<S>,
) -> Option<(Self, &'b S::V)>where
'k: 'b,
Get the Cursor
points to the prev key-value pair, also with a reference to the value.
This is faster than first prev
, then value
.
Sourcepub fn next<'a, 'b, S: NodeStore<K = K>>(
&'a self,
tree: &'b BPlusTree<S>,
) -> Option<Self>
pub fn next<'a, 'b, S: NodeStore<K = K>>( &'a self, tree: &'b BPlusTree<S>, ) -> Option<Self>
Get the Cursor
points to the next key-value pair. If the key for self
is deleted, then
this returns the cursor for the key value pair just larger than the deleted key.
Sourcepub fn next_with_value<'a, 'b, S: NodeStore<K = K>>(
&'a self,
tree: &'b BPlusTree<S>,
) -> Option<(Self, &'b S::V)>where
'k: 'b,
pub fn next_with_value<'a, 'b, S: NodeStore<K = K>>(
&'a self,
tree: &'b BPlusTree<S>,
) -> Option<(Self, &'b S::V)>where
'k: 'b,
Get the Cursor
points to the next key-value pair, also with a reference to the value.