Skip to main content

NavCursorMut

Struct NavCursorMut 

Source
pub struct NavCursorMut<'a, K, V, S, A, P>
where P: TreePolicy<K = K, V = V, S = S>, A: Allocator,
{ /* private fields */ }
Expand description

A mutable navigation cursor for an augmented Red-Black tree layout.

NavCursorMut provides a stateful, bidirectionally navigable handle over the tree nodes. It uniquely allows for read-only key access, read-only tree statistics access, and mutable value adjustments via a specialized internal RAII guard (crate::NodeGuard).

Because values can be modified mutably through this cursor, any mutations that alter secondary tree properties will trigger the augmentation.

§Lifetime Architecture

  • 'a - Binds the exclusive mutable borrow of the underlying tree structural layout. This ensures that the tree cannot be mutated or invalidated by other access vectors while the cursor is actively operating.

Implementations§

Source§

impl<'a, K, V, S, A, P> NavCursorMut<'a, K, V, S, A, P>
where P: TreePolicy<K = K, V = V, S = S>, A: Allocator,

Source

pub fn get(&mut self) -> Option<NodeGuard<'_, K, V, S, P>>

Returns a tuple containing an immutable reference to the key, a mutable value guard, and an immutable reference to the statistics of the current node.

Returns None if the cursor is invalid or exhausted.

Source

pub fn peek_next(&mut self) -> Option<NodeGuard<'_, K, V, S, P>>

Peeks forward to the next in-order node’s data without moving the cursor’s position.

Returns None if there is no subsequent in-order node.

Source

pub fn peek_prev(&mut self) -> Option<NodeGuard<'_, K, V, S, P>>

Peeks backward to the previous in-order node’s data without moving the cursor’s position.

Returns None if there is no prior in-order node.

Source

pub fn peek_parent(&mut self) -> Option<NodeGuard<'_, K, V, S, P>>

Peeks upward to the parent node’s data without moving the cursor’s position.

Returns None if the cursor is at the root of the tree.

Source

pub fn peek_left(&mut self) -> Option<NodeGuard<'_, K, V, S, P>>

Peeks downward to the left child node’s data without moving the cursor’s position.

Returns None if there is no left child.

Source

pub fn peek_right(&mut self) -> Option<NodeGuard<'_, K, V, S, P>>

Peeks downward to the right child node’s data without moving the cursor’s position.

Returns None if there is no right child.

Source

pub fn next(&mut self) -> Option<NodeGuard<'_, K, V, S, P>>

Moves the cursor to the next sequential node in-order and returns its data components.

If no subsequent node exists, the cursor is advanced to an empty (None) state.

Source

pub fn prev(&mut self) -> Option<NodeGuard<'_, K, V, S, P>>

Moves the cursor to the previous sequential node in-order and returns its data components.

If no prior node exists, the cursor is advanced to an empty (None) state.

Source

pub fn parent(&mut self) -> Option<NodeGuard<'_, K, V, S, P>>

Moves the cursor up to the parent node and returns its data components.

Returns None and leaves the cursor unchanged if no parent exists.

Source

pub fn left(&mut self) -> Option<NodeGuard<'_, K, V, S, P>>

Moves the cursor down into the left child node and returns its data components.

Returns None and leaves the cursor unchanged if no left child exists.

Source

pub fn right(&mut self) -> Option<NodeGuard<'_, K, V, S, P>>

Moves the cursor down into the right child node and returns its data components.

Returns None and leaves the cursor unchanged if no right child exists.

Source

pub fn remove(&mut self) -> Option<(K, V)>

Removes the node currently pointed to by the cursor from the tree structure, returning its owned key and value coordinates.

This operation triggers full internal Red-Black tree rebalancing and augmented stat updates along the tree lineage.

Returns None if the cursor is already empty or invalid.

Trait Implementations§

Source§

impl<'a, K: Debug, V: Debug, S: Debug, A, P> Debug for NavCursorMut<'a, K, V, S, A, P>
where P: TreePolicy<K = K, V = V, S = S> + Debug, A: Allocator + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, K, V, S, A, P> !Send for NavCursorMut<'a, K, V, S, A, P>

§

impl<'a, K, V, S, A, P> !Sync for NavCursorMut<'a, K, V, S, A, P>

§

impl<'a, K, V, S, A, P> !UnwindSafe for NavCursorMut<'a, K, V, S, A, P>

§

impl<'a, K, V, S, A, P> Freeze for NavCursorMut<'a, K, V, S, A, P>

§

impl<'a, K, V, S, A, P> RefUnwindSafe for NavCursorMut<'a, K, V, S, A, P>

§

impl<'a, K, V, S, A, P> Unpin for NavCursorMut<'a, K, V, S, A, P>
where P: Unpin,

§

impl<'a, K, V, S, A, P> UnsafeUnpin for NavCursorMut<'a, K, V, S, A, P>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.