pub struct Double<T> { /* private fields */ }
Expand description
Double
is a double linked list referencing the head, the tail node node and the length of the list.
Implementations§
Source§impl<T> Double<T>
impl<T> Double<T>
Sourcepub fn remove(&mut self, value: T) -> Result<bool, Error>
pub fn remove(&mut self, value: T) -> Result<bool, Error>
Remove a node from the list. Returns true if the value is found and removed. If the value is not found, it returns an error.
Sourcepub fn search(&self, value: T) -> Result<bool, Error>
pub fn search(&self, value: T) -> Result<bool, Error>
Search for a value in the list, returns true if the value is found. If the value is not found, it returns an error.
Sourcepub fn update(&mut self, old_value: T, new_value: T) -> Result<bool, Error>
pub fn update(&mut self, old_value: T, new_value: T) -> Result<bool, Error>
Update a value in the list, returns true if the value is found and updated. If the value is not found, it returns an error.
Sourcepub fn from_vec(values: Vec<T>) -> Self
pub fn from_vec(values: Vec<T>) -> Self
Create a new instance of the double linked list from a vector.
Sourcepub fn pop(&mut self) -> Result<Option<T>, Error>
pub fn pop(&mut self) -> Result<Option<T>, Error>
Remove the last node from the list. Returns the value of the removed node. If the list is empty, it returns an error.
pub fn print(&self)
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Double<T>
impl<T> !RefUnwindSafe for Double<T>
impl<T> !Send for Double<T>
impl<T> !Sync for Double<T>
impl<T> Unpin for Double<T>
impl<T> !UnwindSafe for Double<T>
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