pub struct SLinkedList<P, Tag>{ /* private fields */ }Available on crate feature
slist only.Expand description
A singly linked list with head and tail pointers (FIFO queue).
Supports O(1) push to back and pop from front.
Implementations§
Source§impl<P, Tag> SLinkedList<P, Tag>
impl<P, Tag> SLinkedList<P, Tag>
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the list pointers. Note: This does NOT drop the elements.
Use drain or drop if you need to release owned resources.
Sourcepub fn get_length(&self) -> u64
pub fn get_length(&self) -> u64
Returns the length of the list.
Sourcepub fn push_back(&mut self, item: P)
pub fn push_back(&mut self, item: P)
Appends an element to the back of the list (FIFO: enqueue).
Sourcepub fn pop_front(&mut self) -> Option<P>
pub fn pop_front(&mut self) -> Option<P>
Removes the first element and returns it (FIFO: dequeue).
Sourcepub fn is_front(&self, node: &P::Target) -> bool
pub fn is_front(&self, node: &P::Target) -> bool
Checks if the given node is the head of the list.
Sourcepub fn iter<'a>(&'a self) -> SLinkedListIterator<'a, P, Tag> ⓘ
pub fn iter<'a>(&'a self) -> SLinkedListIterator<'a, P, Tag> ⓘ
Returns an iterator over the list (borrowed).
Sourcepub fn drain<'a>(&'a mut self) -> SLinkedListDrainer<'a, P, Tag> ⓘ
pub fn drain<'a>(&'a mut self) -> SLinkedListDrainer<'a, P, Tag> ⓘ
Returns a draining iterator that removes items from the list.
Trait Implementations§
Source§impl<P, Tag> Debug for SLinkedList<P, Tag>
impl<P, Tag> Debug for SLinkedList<P, Tag>
Source§impl<P, Tag> Drop for SLinkedList<P, Tag>
impl<P, Tag> Drop for SLinkedList<P, Tag>
impl<P, Tag> Send for SLinkedList<P, Tag>
Auto Trait Implementations§
impl<P, Tag> Freeze for SLinkedList<P, Tag>
impl<P, Tag> RefUnwindSafe for SLinkedList<P, Tag>
impl<P, Tag> !Sync for SLinkedList<P, Tag>
impl<P, Tag> Unpin for SLinkedList<P, Tag>
impl<P, Tag> UnwindSafe for SLinkedList<P, Tag>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more