pub trait RandomAccessSequence<T: Copy> {
// Required methods
fn len(&self) -> usize;
unsafe fn get_unchecked(&self, index: usize) -> T;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn get(&self, index: usize) -> T { ... }
}
Expand description
A trait for a collection that allows indexed access by value. This trait is used to abstract over different types of collections - scalar slices, slices of packed field elements including subranges of collections.
Required Methods§
fn len(&self) -> usize
Sourceunsafe fn get_unchecked(&self, index: usize) -> T
unsafe fn get_unchecked(&self, index: usize) -> T
Returns a copy of the element at the given index.
§Safety
The caller must ensure that the index
< self.len()
.