Struct intrusive_collections::linked_list::CursorMut [] [src]

pub struct CursorMut<'a, A: Adaptor<Link> + 'a> {
    // some fields omitted
}

A cursor which provides mutable access to a LinkedList.

Methods

impl<'a, A: Adaptor<Link>> CursorMut<'a, A>
[src]

fn is_null(&self) -> bool

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

fn get_raw(&self) -> Option<*mut A::Container>

Returns a raw pointer to the object that the cursor is currently pointing to.

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

fn get(&self) -> Option<&'a A::Container>

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.

unsafe fn get_mut(&mut self) -> Option<&'a mut A::Container>

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

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

Safety

This function returns a &mut reference but makes no guarantee that this references is not aliased. You must ensure that there are no live references (mutable or immutable) to this object when calling this function.

fn as_cursor(&self) -> Cursor<A>

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.

fn move_next(&mut self)

Moves the cursor to the next element of the LinkedList.

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

fn move_prev(&mut self)

Moves the cursor to the previous element of the LinkedList.

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

fn remove(&mut self) -> Option<IntrusiveRef<A::Container>>

Removes the current element from the LinkedList.

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

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

fn replace_with(&mut self, val: IntrusiveRef<A::Container>) -> Option<IntrusiveRef<A::Container>>

Removes the current element from the LinkedList 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.

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

Panics

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

fn insert_after(&mut self, val: IntrusiveRef<A::Container>)

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

If the cursor is pointing at the null object then the new element is inserted at the front of the LinkedList.

Panics

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

fn insert_before(&mut self, val: IntrusiveRef<A::Container>)

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

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

Panics

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

fn splice_after(&mut self, list: LinkedList<A>)

Inserts the elements from the given LinkedList after the current one.

If the cursor is pointing at the null object then the new elements are inserted at the start of the LinkedList.

fn splice_before(&mut self, list: LinkedList<A>)

Moves all element from the given LinkedList before the current one.

If the cursor is pointing at the null object then the new elements are inserted at the end of the LinkedList.

fn split_after(&mut self) -> LinkedList<A> where A: Clone

Splits the list into two after the current element. This will return a new list consisting of everything after the cursor, with the original list retaining everything before.

If the cursor is pointing at the null object then the entire contents of the LinkedList are moved.

fn split_before(&mut self) -> LinkedList<A> where A: Clone

Splits the list into two before the current element. This will return a new list consisting of everything before the cursor, with the original list retaining everything after.

If the cursor is pointing at the null object then the entire contents of the LinkedList are moved.