pub struct List<T> { /* private fields */ }
Expand description
List is collection of homogeneous objects.
Implementations§
Source§impl<T> List<T>
impl<T> List<T>
Sourcepub fn find(&self, element: &T) -> Option<&T>where
T: PartialEq,
pub fn find(&self, element: &T) -> Option<&T>where
T: PartialEq,
Return the first occurrence of the specified element
or None
in the list.
Sourcepub fn contains(&self, element: &T) -> boolwhere
T: PartialEq,
pub fn contains(&self, element: &T) -> boolwhere
T: PartialEq,
Return true
if the list contains element
.
Sourcepub fn count(&self, element: &T) -> usizewhere
T: PartialEq,
pub fn count(&self, element: &T) -> usizewhere
T: PartialEq,
Count the number of occurrence of the specified element
.
Sourcepub fn uniquify(&self) -> Self
pub fn uniquify(&self) -> Self
Return a list that eliminates duplicate elements and keep the original relative order of elements.
Sourcepub fn insert(&mut self, index: i32, element: T)
pub fn insert(&mut self, index: i32, element: T)
Insert the specified element
at the specified index
in the list.
Index can be negative.
Sourcepub fn remove(&mut self, index: i32) -> T
pub fn remove(&mut self, index: i32) -> T
Remove and return the element
at the specified index
in the list.
Index can be negative.
Trait Implementations§
Source§impl<T> AddAssign<&List<T>> for List<T>
impl<T> AddAssign<&List<T>> for List<T>
Source§fn add_assign(&mut self, rhs: &List<T>)
fn add_assign(&mut self, rhs: &List<T>)
Performs the
+=
operation. Read moreSource§impl<T> AddAssign for List<T>
impl<T> AddAssign for List<T>
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moreSource§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> IntoIterator for List<T>
impl<T> IntoIterator for List<T>
Source§impl<T: Ord> Ord for List<T>
impl<T: Ord> Ord for List<T>
Source§impl<T: PartialOrd> PartialOrd for List<T>
impl<T: PartialOrd> PartialOrd for List<T>
impl<T: Eq> Eq for List<T>
impl<T> StructuralPartialEq for List<T>
Auto Trait Implementations§
impl<T> Freeze for List<T>
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