pub struct SinglyLinkedList<T> { /* private fields */ }Expand description
A singly linked list.
Implementations§
Source§impl<T> SinglyLinkedList<T>
impl<T> SinglyLinkedList<T>
Sourcepub fn insert(&mut self, index: usize, value: T) -> Result<(), Error>
pub fn insert(&mut self, index: usize, value: T) -> Result<(), Error>
Inserts a value at the given index.
Sourcepub fn remove(&mut self, value: &T) -> Result<(), Error>where
T: PartialEq,
pub fn remove(&mut self, value: &T) -> Result<(), Error>where
T: PartialEq,
Removes the first occurrence of a value.
Sourcepub fn pop(&mut self, index: Option<usize>) -> Result<T, Error>
pub fn pop(&mut self, index: Option<usize>) -> Result<T, Error>
Removes and returns the item at the given index, defaulting to the last.
Sourcepub fn get_mut(&mut self, index: usize) -> Result<&mut T, Error>
pub fn get_mut(&mut self, index: usize) -> Result<&mut T, Error>
Returns a mutable reference to the item at index.
Trait Implementations§
Source§impl<T: Debug> Debug for SinglyLinkedList<T>
impl<T: Debug> Debug for SinglyLinkedList<T>
Auto Trait Implementations§
impl<T> Freeze for SinglyLinkedList<T>
impl<T> RefUnwindSafe for SinglyLinkedList<T>where
Vec<SNode<T>>: RefUnwindSafe,
impl<T> Send for SinglyLinkedList<T>
impl<T> Sync for SinglyLinkedList<T>
impl<T> Unpin for SinglyLinkedList<T>
impl<T> UnsafeUnpin for SinglyLinkedList<T>where
Vec<SNode<T>>: UnsafeUnpin,
impl<T> UnwindSafe for SinglyLinkedList<T>where
Vec<SNode<T>>: UnwindSafe,
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