Trait LabelledArray

Source
pub trait LabelledArray<E, L>: CopyMap<usize, E> {
    // Required methods
    fn with_label<F>(label: L, len: usize, func: F) -> Self
       where F: FnMut(&mut L, usize) -> E;
    fn get_label(&self) -> &L;
    unsafe fn get_unchecked(&self, idx: usize) -> &E;
}
Expand description

Array with an optional label struct stored next to the data.

Required Methods§

Source

fn with_label<F>(label: L, len: usize, func: F) -> Self
where F: FnMut(&mut L, usize) -> E,

Create a new array, with values initialized using a provided function, and label initialized to a provided value.

Source

fn get_label(&self) -> &L

Get a reference to the label.

Source

unsafe fn get_unchecked(&self, idx: usize) -> &E

Get a reference to the element at a specified index. Implementations of this method shouldn’t do any safety checks.

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.

Implementors§

Source§

impl<A, R, E, L> LabelledArray<E, L> for RcArray<A, R, E, L>
where A: LabelledArray<E, R>, R: RefCounter<L>,

Source§

impl<E, L, P> LabelledArray<E, L> for SafeArray<E, L, P>
where P: SafeArrayPtr<E, L>,