Struct CDLL

Source
pub struct CDLL<T> { /* private fields */ }
Expand description

Implementation of a Circular Doubly Linked List.

Trait Implementations§

Source§

impl<T> Default for CDLL<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> From<Box<DNode<T>>> for CDLL<T>

Source§

fn from(node: Box<DNode<T>>) -> Self

Converts to this type from the input type.
Source§

impl<T> LL<T> for CDLL<T>

Source§

fn len(&self) -> usize

Return the length of the list.
Source§

fn head(&self) -> *mut DNode<T>

Returns a pointer to the beginning of the list.
Source§

fn tail(&self) -> *mut DNode<T>

Returns a pointer to the end of the list.
Source§

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)

Inserts data at the specified index from the left of the list.
Source§

fn print_addresses(&self)
where T: Debug,

Print the memory address layout of the list.
Source§

fn clear(&mut self)

Remove all elements from the list.
Source§

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>

Delete the first element from the list.
Source§

fn delete_tail(&mut self) -> Option<T>

Delete the last element from the list.
Source§

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,

Inserts data in the sorted position of the list, sorting it first it not already sorted.
Source§

fn insert_tail(&mut self, data: T)

Inserts data at the end of the list.
Source§

fn is_empty(&self) -> bool

Returns true if the list is empty.
Source§

fn is_sorted(&self) -> bool
where T: PartialOrd,

Returns true if the list is sorted.
Source§

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>

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,

Pretty print the list.
Source§

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,

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.