SoAVec

Trait SoAVec 

Source
pub trait SoAVec<T: SOA> {
    type Ref<'t>
       where Self: 't;
    type Slice<'t>: SoASlice<T> + IntoSoAIter<'t, T>
       where Self: 't;
    type Iter<'t>: Iterator<Item = Self::Ref<'t>>
       where Self: 't;
    type Ptr;
    type RefMut<'t>
       where Self: 't;
    type SliceMut<'t>: SoASliceMut<T>
       where Self: 't;
    type IterMut<'t>: Iterator<Item = Self::RefMut<'t>>
       where Self: 't;
    type PtrMut;

Show 37 methods // Required methods fn len(&self) -> usize; fn is_empty(&self) -> bool; fn as_slice<'c, 'a: 'c>(&'c self) -> Self::Slice<'c> where Self: 'a; fn slice<'c, 'a: 'c>( &'c self, index: impl RangeBounds<usize>, ) -> Self::Slice<'c> where Self: 'a; fn get(&self, index: usize) -> Option<Self::Ref<'_>>; fn index(&self, index: usize) -> Self::Ref<'_>; fn iter(&self) -> Self::Iter<'_>; fn as_ptr(&self) -> Self::Ptr; fn as_mut_slice<'c, 'a: 'c>(&'c mut self) -> Self::SliceMut<'c> where Self: 'a; fn slice_mut( &mut self, index: impl RangeBounds<usize>, ) -> Self::SliceMut<'_>; fn get_mut(&mut self, index: usize) -> Option<Self::RefMut<'_>>; fn index_mut(&mut self, index: usize) -> Self::RefMut<'_>; fn iter_mut(&mut self) -> Self::IterMut<'_>; fn apply_index(&mut self, indices: &[usize]); fn as_mut_ptr(&mut self) -> Self::PtrMut; fn new() -> Self; fn with_capacity(capacity: usize) -> Self; fn capacity(&self) -> usize; fn reserve(&mut self, additional: usize); fn reserve_exact(&mut self, additional: usize); fn shrink_to_fit(&mut self); fn truncate(&mut self, len: usize); fn push(&mut self, value: T); fn swap_remove(&mut self, index: usize) -> T; fn insert(&mut self, index: usize, element: T); fn replace(&mut self, index: usize, element: T) -> T; fn remove(&mut self, index: usize) -> T; fn pop(&mut self) -> Option<T>; fn append(&mut self, other: &mut Self); fn clear(&mut self); fn split_off(&mut self, at: usize) -> Self; // Provided methods fn first(&self) -> Option<Self::Ref<'_>> { ... } fn last(&self) -> Option<Self::Ref<'_>> { ... } fn sort_by<F>(&mut self, f: F) where F: FnMut(Self::Ref<'_>, Self::Ref<'_>) -> Ordering { ... } fn sort_by_key<F, K>(&mut self, f: F) where F: FnMut(Self::Ref<'_>) -> K, K: Ord { ... } fn first_mut(&mut self) -> Option<Self::RefMut<'_>> { ... } fn last_mut(&mut self) -> Option<Self::RefMut<'_>> { ... }
}
Expand description

The interface for the Vec-like struct-of-arrays type. A generalization of SoASliceMut whose methods can also re-size the underlying arrays.

NOTE: This interface is incomplete and additional methods may be added as needed.

Required Associated Types§

Source

type Ref<'t> where Self: 't

The type that elements will be proxied with as

Source

type Slice<'t>: SoASlice<T> + IntoSoAIter<'t, T> where Self: 't

The type representing immutable slices of elements

Source

type Iter<'t>: Iterator<Item = Self::Ref<'t>> where Self: 't

The type used for iteration over Self::Ref

Source

type Ptr

The const pointer type interface

Source

type RefMut<'t> where Self: 't

The type that elements will be proxied with as when mutable

Source

type SliceMut<'t>: SoASliceMut<T> where Self: 't

The type representing mutable slices of elements

Source

type IterMut<'t>: Iterator<Item = Self::RefMut<'t>> where Self: 't

The type used for iteration over Self::RefMut

Source

type PtrMut

The mut pointer type interface

Required Methods§

Source

fn len(&self) -> usize

Returns the number of elements in the arrays

Source

fn is_empty(&self) -> bool

Returns true if the arrays has a length of 0.

Source

fn as_slice<'c, 'a: 'c>(&'c self) -> Self::Slice<'c>
where Self: 'a,

Create an immutable slice of the arrays

Source

fn slice<'c, 'a: 'c>( &'c self, index: impl RangeBounds<usize>, ) -> Self::Slice<'c>
where Self: 'a,

Create a slice of this vector matching the given range. This is analogous to Index<Range<usize>>.

Source

fn get(&self, index: usize) -> Option<Self::Ref<'_>>

Analogous to slice::get()

Source

fn index(&self, index: usize) -> Self::Ref<'_>

Analogous to core::ops::Index::index() for usize

Source

fn iter(&self) -> Self::Iter<'_>

Create an immutable iterator

Source

fn as_ptr(&self) -> Self::Ptr

Obtain a const pointer type for this data

Source

fn as_mut_slice<'c, 'a: 'c>(&'c mut self) -> Self::SliceMut<'c>
where Self: 'a,

Analogous to Vec::as_mut_slice()

Source

fn slice_mut(&mut self, index: impl RangeBounds<usize>) -> Self::SliceMut<'_>

Create a mutable slice of this vector matching the given range. This is analogous to IndexMut<Range<usize>>.

Source

fn get_mut(&mut self, index: usize) -> Option<Self::RefMut<'_>>

Analogous to slice::get_mut()

Source

fn index_mut(&mut self, index: usize) -> Self::RefMut<'_>

Analogous to core::ops::IndexMut::index_mut() for usize

Source

fn iter_mut(&mut self) -> Self::IterMut<'_>

Creates a mutable iterator

Source

fn apply_index(&mut self, indices: &[usize])

Re-order the arrays using the provided indices. This is provided so that generic sorting methods can be implemented because closure-passing trait methods encounter difficulties with lifetimes.

Source

fn as_mut_ptr(&mut self) -> Self::PtrMut

Obtain a mut pointer type for this data

Source

fn new() -> Self

Create a new, empty struct of arrays

Source

fn with_capacity(capacity: usize) -> Self

Create a new, empty struct of arrays with the specified capacity

Source

fn capacity(&self) -> usize

Analogous to Vec::capacity

Source

fn reserve(&mut self, additional: usize)

Analogous to Vec::reserve

Source

fn reserve_exact(&mut self, additional: usize)

Analogous to Vec::reserve_exact

Source

fn shrink_to_fit(&mut self)

Analogous to Vec::shrink_to_fit

Source

fn truncate(&mut self, len: usize)

Analogous to Vec::truncate

Source

fn push(&mut self, value: T)

Add a singular value of T to the arrays. Analogous to Vec::push

Source

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

Analogous to Vec::swap_remove

Source

fn insert(&mut self, index: usize, element: T)

Analogous to Vec::insert

Source

fn replace(&mut self, index: usize, element: T) -> T

Source

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

Analogous to Vec::remove

Source

fn pop(&mut self) -> Option<T>

Analogous to Vec::pop

Source

fn append(&mut self, other: &mut Self)

Analogous to Vec::append

Source

fn clear(&mut self)

Analogous to Vec::clear

Source

fn split_off(&mut self, at: usize) -> Self

Analogous to Vec::split_off

Provided Methods§

Source

fn first(&self) -> Option<Self::Ref<'_>>

Analogous to slice::first()

Source

fn last(&self) -> Option<Self::Ref<'_>>

Analogous to slice::last()

Source

fn sort_by<F>(&mut self, f: F)
where F: FnMut(Self::Ref<'_>, Self::Ref<'_>) -> Ordering,

Source

fn sort_by_key<F, K>(&mut self, f: F)
where F: FnMut(Self::Ref<'_>) -> K, K: Ord,

Source

fn first_mut(&mut self) -> Option<Self::RefMut<'_>>

Analogous to slice::first_mut()

Source

fn last_mut(&mut self) -> Option<Self::RefMut<'_>>

Analogous to slice::last_mut()

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§