pub struct CDLL<T> { /* private fields */ }
Expand description
Implementation of a Circular Doubly Linked List.
Trait Implementations§
Source§impl<T> LL<T> for CDLL<T>
impl<T> LL<T> for CDLL<T>
Source§fn delete_at_index(&mut self, index: usize) -> Option<T>
fn delete_at_index(&mut self, index: usize) -> Option<T>
Delete the element at the specified
index
.Source§fn insert(&mut self, data: T, index: usize)
fn insert(&mut self, data: T, index: usize)
Inserts
data
at the specified index
from the left of the list.Source§fn print_addresses(&self)where
T: Debug,
fn print_addresses(&self)where
T: Debug,
Print the memory address layout of the list.
Source§fn delete(&mut self, data: &T) -> Option<T>where
T: PartialEq,
fn delete(&mut self, data: &T) -> Option<T>where
T: PartialEq,
Delete the element that matches
data
from the list.Source§fn delete_head(&mut self) -> Option<T>
fn delete_head(&mut self) -> Option<T>
Delete the first element from the list.
Source§fn delete_tail(&mut self) -> Option<T>
fn delete_tail(&mut self) -> Option<T>
Delete the last element from the list.
Source§fn insert_head(&mut self, data: T)
fn insert_head(&mut self, data: T)
Inserts
data
at the beginning of the list.Source§fn insert_sorted(&mut self, data: T)where
T: Default + PartialOrd,
fn insert_sorted(&mut self, data: T)where
T: Default + PartialOrd,
Inserts
data
in the sorted position of the list, sorting it first it
not already sorted.Source§fn insert_tail(&mut self, data: T)
fn insert_tail(&mut self, data: T)
Inserts
data
at the end of the list.Source§fn iter_once(&self) -> LLIterOnce<'_, T> ⓘ
fn iter_once(&self) -> LLIterOnce<'_, T> ⓘ
Return an iterator that visits once each of the elements of the list.
Source§fn iter(&self) -> LLIter<'_, T> ⓘ
fn iter(&self) -> LLIter<'_, T> ⓘ
Return an iterator that visits each of the elements of the list by
following its internal pointers.
Source§fn print(&self)where
T: Debug + PartialOrd,
fn print(&self)where
T: Debug + PartialOrd,
Pretty print the list.
Source§fn search(&self, data: &T) -> Option<&T>where
T: PartialEq,
fn search(&self, data: &T) -> Option<&T>where
T: PartialEq,
Search
data
in the list, and returns a reference to it if found, or
None.Source§fn sort(&mut self)where
T: Default + PartialOrd,
fn sort(&mut self)where
T: Default + PartialOrd,
Sort the list in-place using insertion-sort.
Auto Trait Implementations§
impl<T> Freeze for CDLL<T>
impl<T> RefUnwindSafe for CDLL<T>where
T: RefUnwindSafe,
impl<T> !Send for CDLL<T>
impl<T> !Sync for CDLL<T>
impl<T> Unpin for CDLL<T>
impl<T> UnwindSafe for CDLL<T>where
T: RefUnwindSafe,
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