Struct xarray::Cursor

source ·
pub struct Cursor<'a, I, M>
where I: ItemEntry, M: Into<XMark>,
{ /* 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>

source

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.

source

pub fn index(&self) -> u64

Returns the target index of the cursor.

source

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.

source

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.

source

pub fn is_marked(&mut self, mark: M) -> bool

Checks whether the target item is marked with the input mark.

If the target item does not exist, this method will also return false.

Auto Trait Implementations§

§

impl<'a, I, M> Freeze for Cursor<'a, I, M>

§

impl<'a, I, M> RefUnwindSafe for Cursor<'a, I, M>
where M: RefUnwindSafe, I: RefUnwindSafe,

§

impl<'a, I, M> Send for Cursor<'a, I, M>
where M: Sync, I: Sync + Send,

§

impl<'a, I, M> Sync for Cursor<'a, I, M>
where M: Sync, I: Sync + Send,

§

impl<'a, I, M> Unpin for Cursor<'a, I, M>

§

impl<'a, I, M> !UnwindSafe for Cursor<'a, I, M>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.