pub trait ArrayCollection<T>:
Collection
+ Index<usize>
+ IndexMut<usize>{
// Required methods
fn get(&self, index: usize) -> Option<&T>;
fn index_list(&self, item: &T) -> Option<Vec<usize>>;
fn index_of(&self, item: &T) -> Option<usize>;
fn last_index_of(&self, item: &T) -> Option<usize>;
fn set(&mut self, index: usize, item: &T) -> Option<T>;
fn slice(&mut self, r: Range<usize>) -> Box<[T]>;
}
Required Methods§
Sourcefn 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.
Sourcefn 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 ‘array’ doesn’t contain the specified element.
Sourcefn 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 ‘array’ doesn’t contain the specified element.
Sourcefn 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 ‘array’ doesn’t contain the specified element.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.