pub struct List<G: GetLinksWrapped> { /* private fields */ }Expand description
A linked list.
Elements in the list are wrapped and ownership is transferred to the list while the element is in the list.
Implementations§
Source§impl<G: GetLinksWrapped> List<G>
impl<G: GetLinksWrapped> List<G>
Sourcepub fn iter(&self) -> Iterator<'_, G>
pub fn iter(&self) -> Iterator<'_, G>
Returns an iterator for the list starting at the first entry.
Sourcepub fn push_back(&mut self, data: G::Wrapped)
pub fn push_back(&mut self, data: G::Wrapped)
Adds the given object to the end (back) of the list.
It is dropped if it’s already on this (or another) list; this can happen for reference-counted objects, so dropping means decrementing the reference count.
Sourcepub fn push_front(&mut self, data: G::Wrapped)
pub fn push_front(&mut self, data: G::Wrapped)
Adds the given object to the first (front) of the list.
It is dropped if it’s already on this (or another) list; this can happen for reference-counted objects, so dropping means decrementing the reference count.
Sourcepub unsafe fn insert_after(&mut self, existing: &G::Wrapped, data: G::Wrapped)
pub unsafe fn insert_after(&mut self, existing: &G::Wrapped, data: G::Wrapped)
Inserts the given object after existing.
It is dropped if it’s already on this (or another) list; this can happen for reference-counted objects, so dropping means decrementing the reference count.
§Safety
Callers must ensure that existing points to a valid entry that is on the list.
Sourcepub unsafe fn remove(&mut self, data: &G::Wrapped) -> Option<G::Wrapped>
pub unsafe fn remove(&mut self, data: &G::Wrapped) -> Option<G::Wrapped>
Removes the given entry.
§Safety
Callers must ensure that data is either on this list or in no list. It being on another
list leads to memory unsafety.
Sourcepub fn pop_front(&mut self) -> Option<G::Wrapped>
pub fn pop_front(&mut self) -> Option<G::Wrapped>
Removes the element currently at the front of the list and returns it.
Returns None if the list is empty.
Sourcepub fn cursor_front_mut(&mut self) -> CursorMut<'_, G>
pub fn cursor_front_mut(&mut self) -> CursorMut<'_, G>
Returns a mutable cursor starting on the first (front) element of the list.