Trait SoaArray

Source
pub trait SoaArray {
    type Item: Soapy;

    // Required methods
    fn as_slice(&self) -> SliceRef<'_, Self::Item>;
    fn as_mut_slice(&mut self) -> SliceMut<'_, Self::Item>;
}
Expand description

A compile-time, fixed-size SoA array.

What Slice is to [T], SoA arrays are to [T; N]. They are useful whenever you have const data you want to structure in SoA form.

When deriving Soapy for some type Foo, a struct FooArray is also created which implements this trait. The primary way to create a SoA array is to use the FooArray::from_array method for that type, which cannot be included in this trait because it is const.

Required Associated Types§

Source

type Item: Soapy

The type that the SoA array stores.

When using the Soapy derive macro, this is the type that was derived from and which is the generic parameter of Slice and Soa.

Required Methods§

Source

fn as_slice(&self) -> SliceRef<'_, Self::Item>

Returns a Slice containing the entire array.

Source

fn as_mut_slice(&mut self) -> SliceMut<'_, Self::Item>

Returns a mutable Slice containing the entire array.

Implementors§