pub struct List<T: ?Sized> { /* private fields */ }
Expand description
An intrusive doubly-linked list.
This data structure may be used as a first-in, first-out queue by using the
List::push_front
and List::pop_back
methods. It also supports
random-access removals using the List::remove
method.
In order to be part of a List
, a type T
must implement Linked
for
list::Links<T>
.
Implementations
sourceimpl<T: Linked<Links<T>> + ?Sized> List<T>
impl<T: Linked<Links<T>> + ?Sized> List<T>
sourcepub fn assert_valid(&self)
pub fn assert_valid(&self)
Asserts as many of the linked list’s invariants as possible.
sourcepub fn push_front(&mut self, item: T::Handle)
pub fn push_front(&mut self, item: T::Handle)
Appends an item to the head of the list.
sourcepub unsafe fn remove(&mut self, item: NonNull<T>) -> Option<T::Handle>
pub unsafe fn remove(&mut self, item: NonNull<T>) -> Option<T::Handle>
Remove an arbitrary node from the list.
Safety
The caller must ensure that the removed node is an element of this linked list, and not any other linked list.
Trait Implementations
impl<T: Linked<Links<T>> + ?Sized> Send for List<T> where
T: Send,
impl<T: Linked<Links<T>> + ?Sized> Sync for List<T> where
T: Sync,
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for List<T> where
T: RefUnwindSafe,
impl<T: ?Sized> Unpin for List<T>
impl<T: ?Sized> UnwindSafe for List<T> where
T: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more