Struct kernel::linked_list::List
source · [−]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
sourceimpl<G: GetLinksWrapped> List<G>
impl<G: GetLinksWrapped> List<G>
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 unsafe fn insert_after(
&mut self,
existing: NonNull<G::EntryType>,
data: G::Wrapped
)
pub unsafe fn insert_after(
&mut self,
existing: NonNull<G::EntryType>,
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(&self) -> Cursor<'_, G>
pub fn cursor_front(&self) -> Cursor<'_, G>
Returns a cursor starting on the first (front) element of the list.
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.
Trait Implementations
sourceimpl<G: GetLinksWrapped> Default for List<G>
impl<G: GetLinksWrapped> Default for List<G>
Auto Trait Implementations
impl<G> RefUnwindSafe for List<G> where
<G as GetLinks>::EntryType: RefUnwindSafe,
impl<G> !Send for List<G>
impl<G> !Sync for List<G>
impl<G> Unpin for List<G>
impl<G> UnwindSafe for List<G> where
<G as GetLinks>::EntryType: 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