[][src]Struct intrusive_collections::rbtree::CursorMut

pub struct CursorMut<'a, A: Adapter> where
    A::LinkOps: RBTreeOps
{ /* fields omitted */ }

A cursor which provides mutable access to a RBTree.

Implementations

impl<'a, A: Adapter> CursorMut<'a, A> where
    A::LinkOps: RBTreeOps
[src]

pub fn is_null(&self) -> bool[src]

Checks if the cursor is currently pointing to the null object.

pub fn get(&self) -> Option<&<A::PointerOps as PointerOps>::Value>[src]

Returns a reference to the object that the cursor is currently pointing to.

This returns None if the cursor is currently pointing to the null object.

pub fn as_cursor(&self) -> Cursor<A>[src]

Returns a read-only cursor pointing to the current element.

The lifetime of the returned Cursor is bound to that of the CursorMut, which means it cannot outlive the CursorMut and that the CursorMut is frozen for the lifetime of the Cursor.

pub fn move_next(&mut self)[src]

Moves the cursor to the next element of the RBTree.

If the cursor is pointer to the null object then this will move it to the first element of the RBTree. If it is pointing to the last element of the RBTree then this will move it to the null object.

pub fn move_prev(&mut self)[src]

Moves the cursor to the previous element of the RBTree.

If the cursor is pointer to the null object then this will move it to the last element of the RBTree. If it is pointing to the first element of the RBTree then this will move it to the null object.

pub fn peek_next(&self) -> Cursor<A>[src]

Returns a cursor pointing to the next element of the RBTree.

If the cursor is pointer to the null object then this will return the first element of the RBTree. If it is pointing to the last element of the RBTree then this will return a null cursor.

pub fn peek_prev(&self) -> Cursor<A>[src]

Returns a cursor pointing to the previous element of the RBTree.

If the cursor is pointer to the null object then this will return the last element of the RBTree. If it is pointing to the first element of the RBTree then this will return a null cursor.

pub fn remove(&mut self) -> Option<<A::PointerOps as PointerOps>::Pointer>[src]

Removes the current element from the RBTree.

A pointer to the element that was removed is returned, and the cursor is moved to point to the next element in the RBTree.

If the cursor is currently pointing to the null object then no element is removed and None is returned.

pub fn replace_with(
    &mut self,
    val: <A::PointerOps as PointerOps>::Pointer
) -> Result<<A::PointerOps as PointerOps>::Pointer, <A::PointerOps as PointerOps>::Pointer>
[src]

Removes the current element from the RBTree and inserts another object in its place.

A pointer to the element that was removed is returned, and the cursor is modified to point to the newly added element.

When using this function you must ensure that the elements in the collection are maintained in increasing order. Failure to do this may lead to find, upper_bound, lower_bound and range returning incorrect results.

If the cursor is currently pointing to the null object then an error is returned containing the given val parameter.

Panics

Panics if the new element is already linked to a different intrusive collection.

pub fn insert_after(&mut self, val: <A::PointerOps as PointerOps>::Pointer)[src]

Inserts a new element into the RBTree after the current one.

When using this function you must ensure that the elements in the collection are maintained in increasing order. Failure to do this may lead to find, upper_bound, lower_bound and range returning incorrect results.

If the cursor is pointing at the null object then the new element is inserted at the start of the RBTree.

Panics

Panics if the new element is already linked to a different intrusive collection.

pub fn insert_before(&mut self, val: <A::PointerOps as PointerOps>::Pointer)[src]

Inserts a new element into the RBTree before the current one.

When using this function you must ensure that the elements in the collection are maintained in increasing order. Failure to do this may lead to find, upper_bound, lower_bound and range returning incorrect results.

If the cursor is pointing at the null object then the new element is inserted at the end of the RBTree.

Panics

Panics if the new element is already linked to a different intrusive collection.

impl<'a, A: for<'b> KeyAdapter<'b>> CursorMut<'a, A> where
    <A as Adapter>::LinkOps: RBTreeOps
[src]

pub fn insert<'c>(&'c mut self, val: <A::PointerOps as PointerOps>::Pointer) where
    <A as KeyAdapter<'c>>::Key: Ord
[src]

Inserts a new element into the RBTree.

The new element will be inserted at the correct position in the tree based on its key, regardless of the current cursor position.

Panics

Panics if the new element is already linked to a different intrusive collection.

Auto Trait Implementations

impl<'a, A> Send for CursorMut<'a, A> where
    A: Send,
    <<A as Adapter>::LinkOps as LinkOps>::LinkPtr: Send,
    <<A as Adapter>::PointerOps as PointerOps>::Pointer: Send

impl<'a, A> Sync for CursorMut<'a, A> where
    A: Sync,
    <<A as Adapter>::LinkOps as LinkOps>::LinkPtr: Sync,
    <<A as Adapter>::PointerOps as PointerOps>::Value: Sync

impl<'a, A> Unpin for CursorMut<'a, A> where
    <<A as Adapter>::LinkOps as LinkOps>::LinkPtr: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.