ArrayInstance

Trait ArrayInstance 

Source
pub trait ArrayInstance: Deref<Target = Array<Self::DType>> + DerefMut {
    type DType: HasAfEnum;

    // Provided methods
    fn af_cast<T: HasAfEnum>(&self) -> Array<T> { ... }
    fn len(&self) -> usize { ... }
    fn get(&self, index: Indexer<'_>) -> Array<Self::DType> { ... }
    fn set<T: ArrayInstance<DType = Self::DType>>(
        &mut self,
        index: &Indexer<'_>,
        other: &T,
    ) { ... }
    fn set_at(&mut self, offset: usize, value: Self::DType) { ... }
    fn to_vec(&self) -> Vec<Self::DType>
       where Self::DType: Clone + Default { ... }
}
Expand description

Defines common access methods for instance of ArrayExt.

Required Associated Types§

Provided Methods§

Source

fn af_cast<T: HasAfEnum>(&self) -> Array<T>

Cast this instance into an af::Array with type T.

Source

fn len(&self) -> usize

How many elements are in this ArrayInstance.

Source

fn get(&self, index: Indexer<'_>) -> Array<Self::DType>

Get the values specified by the given af::Indexer.

Source

fn set<T: ArrayInstance<DType = Self::DType>>( &mut self, index: &Indexer<'_>, other: &T, )

Set the values specified by the given af::Indexer to the corresponding values in T.

Source

fn set_at(&mut self, offset: usize, value: Self::DType)

Set the value at the specified index to value.

Source

fn to_vec(&self) -> Vec<Self::DType>
where Self::DType: Clone + Default,

Copy the data in this af::Array into a new Vec.

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§