pub struct Cursor<'a, I, M>{ /* private fields */ }Expand description
A Cursor can traverse in the XArray by setting or increasing the target index and can
perform read-only operations to the target item represented by the target index.
Cursors act like shared references, so multiple cursors are allowed to operate on a single
XArray at the same time.
The typical way to obtain a Cursor instance is to call XArray::cursor.
Implementations§
source§impl<'a, I: ItemEntry, M: Into<XMark>> Cursor<'a, I, M>
impl<'a, I: ItemEntry, M: Into<XMark>> Cursor<'a, I, M>
sourcepub fn reset_to(&mut self, index: u64)
pub fn reset_to(&mut self, index: u64)
Resets the target index to index.
Once set, the cursor will be positioned on the corresponding leaf node, if the leaf node exists.
sourcepub fn next(&mut self)
pub fn next(&mut self)
Increases the target index of the cursor by one.
Once increased, the cursor will be positioned on the corresponding leaf node, if the leaf node exists.
sourcepub fn load(&mut self) -> Option<I::Ref<'a>>
pub fn load(&mut self) -> Option<I::Ref<'a>>
Loads the item at the target index.
If the target item exists, this method will return a ItemEntry::Ref that acts exactly
like a &'a I wrapped in Some(_). Otherwises, it will return None.