pub struct LinkedList<T> { /* private fields */ }
Expand description
An experimental rewrite of LinkedList to provide a more cursor-oriented API.
Implementations§
Source§impl<T> LinkedList<T>
impl<T> LinkedList<T>
Sourcepub fn new() -> LinkedList<T>
pub fn new() -> LinkedList<T>
Makes a new LinkedList.
Sourcepub fn push_front(&mut self, elem: T)
pub fn push_front(&mut self, elem: T)
Appends an element to the front of the list.
Sourcepub fn pop_back(&mut self) -> Option<T>
pub fn pop_back(&mut self) -> Option<T>
Removes the element at back of the list. Returns None if the list is empty.
Sourcepub fn pop_front(&mut self) -> Option<T>
pub fn pop_front(&mut self) -> Option<T>
Removes the element at front of the list. Returns None if the list is empty.
Sourcepub fn front_mut(&mut self) -> Option<&mut T>
pub fn front_mut(&mut self) -> Option<&mut T>
Gets the element at the front of the list mutably, or None if empty.
Sourcepub fn back_mut(&mut self) -> Option<&mut T>
pub fn back_mut(&mut self) -> Option<&mut T>
Gets the element at the back of the list mutably, or None if empty.
Sourcepub fn insert(&mut self, index: usize, elem: T)
pub fn insert(&mut self, index: usize, elem: T)
Inserts an element at the given index.
§Panics
Panics if the index is greater than the length of the list.
Sourcepub fn remove(&mut self, index: usize) -> Option<T>
pub fn remove(&mut self, index: usize) -> Option<T>
Removes the element at the given index. Returns None if the index is out of bounds.
Sourcepub fn split_at(&mut self, index: usize) -> LinkedList<T>
pub fn split_at(&mut self, index: usize) -> LinkedList<T>
Splits the list into two lists at the given index. Returns the right side of the split. Returns an empty list if index is out of bounds.
Sourcepub fn append(&mut self, other: &mut LinkedList<T>)
pub fn append(&mut self, other: &mut LinkedList<T>)
Appends the given list to the end of this one. The old list will be empty afterwards.
Sourcepub fn splice(&mut self, index: usize, other: &mut LinkedList<T>)
pub fn splice(&mut self, index: usize, other: &mut LinkedList<T>)
Inserts the given list at the given index. The old list will be empty afterwards.
Trait Implementations§
Source§impl<T: Clone> Clone for LinkedList<T>
impl<T: Clone> Clone for LinkedList<T>
Source§fn clone(&self) -> LinkedList<T>
fn clone(&self) -> LinkedList<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<A: Debug> Debug for LinkedList<A>
impl<A: Debug> Debug for LinkedList<A>
Source§impl<T> Drop for LinkedList<T>
impl<T> Drop for LinkedList<T>
Source§impl<A> Extend<A> for LinkedList<A>
impl<A> Extend<A> for LinkedList<A>
Source§fn extend<T: IntoIterator<Item = A>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = A>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl<A> FromIterator<A> for LinkedList<A>
impl<A> FromIterator<A> for LinkedList<A>
Source§fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> LinkedList<A>
fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> LinkedList<A>
Source§impl<A: Hash> Hash for LinkedList<A>
impl<A: Hash> Hash for LinkedList<A>
Source§impl<'a, T> IntoIterator for &'a LinkedList<T>
impl<'a, T> IntoIterator for &'a LinkedList<T>
Source§impl<'a, T> IntoIterator for &'a mut LinkedList<T>
impl<'a, T> IntoIterator for &'a mut LinkedList<T>
Source§impl<T> IntoIterator for LinkedList<T>
impl<T> IntoIterator for LinkedList<T>
Source§impl<A: Ord> Ord for LinkedList<A>
impl<A: Ord> Ord for LinkedList<A>
Source§impl<A: PartialEq> PartialEq for LinkedList<A>
impl<A: PartialEq> PartialEq for LinkedList<A>
Source§impl<A: PartialOrd> PartialOrd for LinkedList<A>
impl<A: PartialOrd> PartialOrd for LinkedList<A>
impl<A: Eq> Eq for LinkedList<A>
Auto Trait Implementations§
impl<T> Freeze for LinkedList<T>
impl<T> RefUnwindSafe for LinkedList<T>where
T: RefUnwindSafe,
impl<T> !Send for LinkedList<T>
impl<T> !Sync for LinkedList<T>
impl<T> Unpin for LinkedList<T>
impl<T> UnwindSafe for LinkedList<T>where
T: RefUnwindSafe + 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)