Trait RandomAccessSequence

Source
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§

Source

fn len(&self) -> usize

Source

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().

Provided Methods§

Source

fn is_empty(&self) -> bool

Source

fn get(&self, index: usize) -> T

Implementations on Foreign Types§

Source§

impl<T: Copy> RandomAccessSequence<T> for &[T]

Source§

fn len(&self) -> usize

Source§

fn get(&self, index: usize) -> T

Source§

unsafe fn get_unchecked(&self, index: usize) -> T

Source§

impl<T: Copy> RandomAccessSequence<T> for &mut [T]

Source§

fn len(&self) -> usize

Source§

fn get(&self, index: usize) -> T

Source§

unsafe fn get_unchecked(&self, index: usize) -> T

Implementors§