[][src]Struct intrusive_collections::singly_linked_list::SinglyLinkedList

pub struct SinglyLinkedList<A: Adapter<Link = Link>> { /* fields omitted */ }

An intrusive singly-linked list.

When this collection is dropped, all elements linked into it will be converted back to owned pointers and dropped.

Methods

impl<A: Adapter<Link = Link>> SinglyLinkedList<A>[src]

pub fn new(adapter: A) -> SinglyLinkedList<A>[src]

Creates an empty SinglyLinkedList.

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

Returns true if the SinglyLinkedList is empty.

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

Returns a null Cursor for this list.

pub fn cursor_mut(&mut self) -> CursorMut<A>[src]

Returns a null CursorMut for this list.

pub unsafe fn cursor_from_ptr(&self, ptr: *const A::Value) -> Cursor<A>[src]

Creates a Cursor from a pointer to an element.

Safety

ptr must be a pointer to an object that is part of this list.

pub unsafe fn cursor_mut_from_ptr(
    &mut self,
    ptr: *const A::Value
) -> CursorMut<A>
[src]

Creates a CursorMut from a pointer to an element.

Safety

ptr must be a pointer to an object that is part of this list.

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

Returns a Cursor pointing to the first element of the list. If the list is empty then a null cursor is returned.

pub fn front_mut(&mut self) -> CursorMut<A>[src]

Returns a CursorMut pointing to the first element of the list. If the the list is empty then a null cursor is returned.

Important traits for Iter<'a, A>
pub fn iter(&self) -> Iter<A>[src]

Gets an iterator over the objects in the SinglyLinkedList.

pub fn clear(&mut self)[src]

Removes all elements from the SinglyLinkedList.

This will unlink all object currently in the list, which requires iterating through all elements in the SinglyLinkedList. Each element is converted back to an owned pointer and then dropped.

pub fn fast_clear(&mut self)[src]

Empties the SinglyLinkedList without unlinking or freeing objects in it.

Since this does not unlink any objects, any attempts to link these objects into another SinglyLinkedList will fail but will not cause any memory unsafety. To unlink those objects manually, you must call the force_unlink function on them.

pub fn take(&mut self) -> SinglyLinkedList<A> where
    A: Clone
[src]

Takes all the elements out of the SinglyLinkedList, leaving it empty. The taken elements are returned as a new SinglyLinkedList.

pub fn push_front(&mut self, val: A::Pointer)[src]

Inserts a new element at the start of the SinglyLinkedList.

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

Removes the first element of the SinglyLinkedList.

This returns None if the SinglyLinkedList is empty.

Trait Implementations

impl<A: Adapter<Link = Link>> Debug for SinglyLinkedList<A> where
    A::Value: Debug
[src]

impl<A: Adapter<Link = Link>> Drop for SinglyLinkedList<A>[src]

impl<A: Adapter<Link = Link> + Send> Send for SinglyLinkedList<A> where
    A::Pointer: Send
[src]

impl<A: Adapter<Link = Link> + Sync> Sync for SinglyLinkedList<A> where
    A::Value: Sync
[src]

impl<A: Adapter<Link = Link>> IntoIterator for SinglyLinkedList<A>[src]

type Item = A::Pointer

The type of the elements being iterated over.

type IntoIter = IntoIter<A>

Which kind of iterator are we turning this into?

impl<'a, A: Adapter<Link = Link> + 'a> IntoIterator for &'a SinglyLinkedList<A>[src]

type Item = &'a A::Value

The type of the elements being iterated over.

type IntoIter = Iter<'a, A>

Which kind of iterator are we turning this into?

impl<A: Adapter<Link = Link> + Default> Default for SinglyLinkedList<A>[src]

Auto Trait Implementations

impl<A> Unpin for SinglyLinkedList<A> where
    A: Unpin

impl<A> !UnwindSafe for SinglyLinkedList<A>

impl<A> !RefUnwindSafe for SinglyLinkedList<A>

Blanket Implementations

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

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

type Error = !

The type returned in the event of a conversion error.

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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

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.

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

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

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