pub struct List<T> { /* private fields */ }
Expand description
A linked list with cardinal indexing and O(log n) get/insert/remove by index
Implementations§
source§impl<T> List<T>
impl<T> List<T>
sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut T>
pub fn get_mut(&mut self, index: usize) -> Option<&mut T>
Borrow the element at the given index
mutably, if any.
sourcepub fn push_front(&mut self, value: T)
pub fn push_front(&mut self, value: T)
Append the given value
to the front of this List
.
sourcepub fn range<R: RangeBounds<usize>>(&self, range: R) -> Iter<'_, T> ⓘ
pub fn range<R: RangeBounds<usize>>(&self, range: R) -> Iter<'_, T> ⓘ
Iterate over the given range
of elements in this List
.
sourcepub fn remove(&mut self, index: usize) -> Option<T>
pub fn remove(&mut self, index: usize) -> Option<T>
Remove and return the value at the given index
, if any.
sourcepub fn starts_with<'a, I: IntoIterator<Item = &'a T>>(
&'a self,
other: I
) -> boolwhere
T: PartialEq,
pub fn starts_with<'a, I: IntoIterator<Item = &'a T>>( &'a self, other: I ) -> boolwhere T: PartialEq,
Return true
if the first elements in this List
are equal to those in the given iter
.
Trait Implementations§
source§impl<T> Extend<T> for List<T>
impl<T> Extend<T> for List<T>
source§fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl<T> FromIterator<T> for List<T>
impl<T> FromIterator<T> for List<T>
source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
source§impl<T: GetSize> GetSize for List<T>
impl<T: GetSize> GetSize for List<T>
source§fn get_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
Determines how many bytes this object occupies inside the heap. Read more
source§fn get_stack_size() -> usize
fn get_stack_size() -> usize
Determines how may bytes this object occupies inside the stack. Read more
source§impl<'a, T> IntoIterator for &'a List<T>
impl<'a, T> IntoIterator for &'a List<T>
source§impl<T> IntoIterator for List<T>
impl<T> IntoIterator for List<T>
source§impl<T: PartialEq> PartialEq<List<T>> for List<T>
impl<T: PartialEq> PartialEq<List<T>> for List<T>
source§impl<T: PartialEq> PartialEq<Vec<T, Global>> for List<T>
impl<T: PartialEq> PartialEq<Vec<T, Global>> for List<T>
impl<T: Eq> Eq for List<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for List<T>where T: RefUnwindSafe,
impl<T> Send for List<T>where T: Send,
impl<T> Sync for List<T>where T: Sync,
impl<T> Unpin for List<T>where T: Unpin,
impl<T> UnwindSafe for List<T>where 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