pub struct Vector<T>{ /* private fields */ }
Expand description
A resizable collection of elements that can be randomly accessed and altered.
Implementations§
Source§impl<T> Vector<T>
impl<T> Vector<T>
Sourcepub fn from_vec(v: &Vec<T>) -> Self
pub fn from_vec(v: &Vec<T>) -> Self
Creates a new ‘vector’ that contains the elements in the specified vector.
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new ‘vector’ with the specified capacity.
Sourcepub fn with_length(length: usize, item: &T) -> Self
pub fn with_length(length: usize, item: &T) -> Self
Creates a new ‘vector’ with the specified length with all values set to the specified value.
Trait Implementations§
Source§impl<T> ArrayCollection<T> for Vector<T>
impl<T> ArrayCollection<T> for Vector<T>
Source§fn get(&self, index: usize) -> Option<&T>
fn get(&self, index: usize) -> Option<&T>
Returns the element at the specified index or None if the index is out-of-bounds.
Source§fn index_list(&self, item: &T) -> Option<Vec<usize>>
fn index_list(&self, item: &T) -> Option<Vec<usize>>
Returns a vector of indices that contain the specified element or None if the ‘vector’ doesn’t contain the specified element.
Source§fn index_of(&self, item: &T) -> Option<usize>
fn index_of(&self, item: &T) -> Option<usize>
Returns the first index of the specified element or None if the ‘vector’ doesn’t contain the specified element.
Source§fn last_index_of(&self, item: &T) -> Option<usize>
fn last_index_of(&self, item: &T) -> Option<usize>
Returns the last index of the specified element or None if the ‘vector’ doesn’t contain the specified element.
Source§impl<T> Collection for Vector<T>
impl<T> Collection for Vector<T>
Source§impl<T> IntoIterator for Vector<T>
impl<T> IntoIterator for Vector<T>
Source§impl<T> ListCollection<T> for Vector<T>
impl<T> ListCollection<T> for Vector<T>
Source§fn append(&mut self, item: T) -> bool
fn append(&mut self, item: T) -> bool
Appends the specified element to the end of the ‘vector’. Returns true if successful.
§Panics
This function panics if the new capacity exceeds isize::MAX bytes.
Source§fn append_all(&mut self, vec: Vec<T>) -> bool
fn append_all(&mut self, vec: Vec<T>) -> bool
Appends the specified vector to the end of the ‘vector’. Returns true if successful.
§Panics
This function panics if the new capacity exceeds isize::MAX bytes.
Source§fn insert(&mut self, index: usize, item: T) -> bool
fn insert(&mut self, index: usize, item: T) -> bool
Inserts the specified element at the specified index. Returns true if successful.
§Panics
This function panics if the specified index is greater than the ‘vector’s’ length.
Source§fn insert_all(&mut self, index: usize, vec: Vec<T>) -> bool
fn insert_all(&mut self, index: usize, vec: Vec<T>) -> bool
Inserts the specified vector at the specified index. Returns true if successful.
§Panics
This function panics if the specified index is greater than the ‘vector’s’ length.
Source§fn prepend(&mut self, item: T) -> bool
fn prepend(&mut self, item: T) -> bool
Prepends the specified element to the start of the ‘vector’. Returns true if successful.
Source§fn prepend_all(&mut self, vec: Vec<T>) -> bool
fn prepend_all(&mut self, vec: Vec<T>) -> bool
Prepends the specified vector to the start of the ‘vector’. Returns true if successful.
Source§fn remove(&mut self, item: T) -> bool
fn remove(&mut self, item: T) -> bool
Removes the last occurrence of the specified element from this ‘vector’. Returns true if the element was removed or false if it was not found.
Source§fn remove_any(&mut self, item: T) -> usize
fn remove_any(&mut self, item: T) -> usize
Removes any occurrence of the specified value from this ‘vector’. Returns the number of occurrences that were removed.
Source§fn remove_all(&mut self, vec: Vec<T>) -> usize
fn remove_all(&mut self, vec: Vec<T>) -> usize
Removes the elements in the specified vector, if they are in this ‘vector’. Returns the number of removed elements. All occurrences of the elements in the specified vector are removed.
Source§fn remove_last(&mut self, item: T) -> bool
fn remove_last(&mut self, item: T) -> bool
Removes the last occurrence of the specified element from this ‘vector’. Returns true if the element was removed or false if it was not found.
Source§fn retain_all(&mut self, vec: Vec<T>) -> usize
fn retain_all(&mut self, vec: Vec<T>) -> usize
Removes all elements from this ‘vector’ that are not in the specified vector. Returns the new size of this ‘vector’ after retaining.
Source§impl<T> PartialEq for Vector<T>
impl<T> PartialEq for Vector<T>
Source§impl<T> Reversible for Vector<T>
impl<T> Reversible for Vector<T>
Source§impl<T> Sortable for Vector<T>
impl<T> Sortable for Vector<T>
Source§fn is_sorted_rev(&self) -> bool
fn is_sorted_rev(&self) -> bool
Returns true if this ‘vector’ is sorted in descending order.
Source§impl<T> VectorCollection<T> for Vector<T>
impl<T> VectorCollection<T> for Vector<T>
Source§fn extend(&mut self, additional: usize, item: &T)
fn extend(&mut self, additional: usize, item: &T)
Extends the length of this ‘vector’ by the specified additional amount with all new elements set to the specified value.
Source§fn reserve(&mut self, additional: usize)
fn reserve(&mut self, additional: usize)
Reserves capacity for the specified number of additional elements.
§Panics
This function panics if the new capacity exceeds isize::MAX bytes.