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§
Sourcetype Slice<'t>: SoASlice<T> + IntoSoAIter<'t, T>
where
Self: 't
type Slice<'t>: SoASlice<T> + IntoSoAIter<'t, T> where Self: 't
The type representing immutable slices of elements
Sourcetype Iter<'t>: Iterator<Item = Self::Ref<'t>>
where
Self: 't
type Iter<'t>: Iterator<Item = Self::Ref<'t>> where Self: 't
The type used for iteration over Self::Ref
Sourcetype SliceMut<'t>: SoASliceMut<T>
where
Self: 't
type SliceMut<'t>: SoASliceMut<T> where Self: 't
The type representing mutable slices of elements
Sourcetype IterMut<'t>: Iterator<Item = Self::RefMut<'t>>
where
Self: 't
type IterMut<'t>: Iterator<Item = Self::RefMut<'t>> where Self: 't
The type used for iteration over Self::RefMut
Required Methods§
Sourcefn as_slice<'c, 'a: 'c>(&'c self) -> Self::Slice<'c>where
Self: 'a,
fn as_slice<'c, 'a: 'c>(&'c self) -> Self::Slice<'c>where
Self: 'a,
Create an immutable slice of the arrays
Sourcefn slice<'c, 'a: 'c>(
&'c self,
index: impl RangeBounds<usize>,
) -> Self::Slice<'c>where
Self: 'a,
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>>.
Sourcefn index(&self, index: usize) -> Self::Ref<'_>
fn index(&self, index: usize) -> Self::Ref<'_>
Analogous to core::ops::Index::index() for usize
Sourcefn as_mut_slice<'c, 'a: 'c>(&'c mut self) -> Self::SliceMut<'c>where
Self: 'a,
fn as_mut_slice<'c, 'a: 'c>(&'c mut self) -> Self::SliceMut<'c>where
Self: 'a,
Analogous to Vec::as_mut_slice()
Sourcefn slice_mut(&mut self, index: impl RangeBounds<usize>) -> Self::SliceMut<'_>
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>>.
Sourcefn index_mut(&mut self, index: usize) -> Self::RefMut<'_>
fn index_mut(&mut self, index: usize) -> Self::RefMut<'_>
Analogous to core::ops::IndexMut::index_mut() for usize
Sourcefn apply_index(&mut self, indices: &[usize])
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.
Sourcefn as_mut_ptr(&mut self) -> Self::PtrMut
fn as_mut_ptr(&mut self) -> Self::PtrMut
Obtain a mut pointer type for this data
Sourcefn with_capacity(capacity: usize) -> Self
fn with_capacity(capacity: usize) -> Self
Create a new, empty struct of arrays with the specified capacity
Sourcefn capacity(&self) -> usize
fn capacity(&self) -> usize
Analogous to Vec::capacity
Sourcefn reserve(&mut self, additional: usize)
fn reserve(&mut self, additional: usize)
Analogous to Vec::reserve
Sourcefn reserve_exact(&mut self, additional: usize)
fn reserve_exact(&mut self, additional: usize)
Analogous to Vec::reserve_exact
Sourcefn shrink_to_fit(&mut self)
fn shrink_to_fit(&mut self)
Analogous to Vec::shrink_to_fit
Sourcefn truncate(&mut self, len: usize)
fn truncate(&mut self, len: usize)
Analogous to Vec::truncate
Sourcefn swap_remove(&mut self, index: usize) -> T
fn swap_remove(&mut self, index: usize) -> T
Analogous to Vec::swap_remove
Sourcefn insert(&mut self, index: usize, element: T)
fn insert(&mut self, index: usize, element: T)
Analogous to Vec::insert
Sourcefn replace(&mut self, index: usize, element: T) -> T
fn replace(&mut self, index: usize, element: T) -> T
Similar to core::mem::replace().
Sourcefn remove(&mut self, index: usize) -> T
fn remove(&mut self, index: usize) -> T
Analogous to Vec::remove
Sourcefn append(&mut self, other: &mut Self)
fn append(&mut self, other: &mut Self)
Analogous to Vec::append
Sourcefn clear(&mut self)
fn clear(&mut self)
Analogous to Vec::clear
Sourcefn split_off(&mut self, at: usize) -> Self
fn split_off(&mut self, at: usize) -> Self
Analogous to Vec::split_off
Provided Methods§
Sourcefn first(&self) -> Option<Self::Ref<'_>>
fn first(&self) -> Option<Self::Ref<'_>>
Analogous to slice::first()
Sourcefn last(&self) -> Option<Self::Ref<'_>>
fn last(&self) -> Option<Self::Ref<'_>>
Analogous to slice::last()
Sourcefn sort_by<F>(&mut self, f: F)
fn sort_by<F>(&mut self, f: F)
[slice::sort_by()](https://doc.rust-lang.org/std/primitive.slice.html#method.sort_by).
Sourcefn sort_by_key<F, K>(&mut self, f: F)
fn sort_by_key<F, K>(&mut self, f: F)
[slice::sort_by()](https://doc.rust-lang.org/std/primitive.slice.html#method.sort_by_key).
Sourcefn first_mut(&mut self) -> Option<Self::RefMut<'_>>
fn first_mut(&mut self) -> Option<Self::RefMut<'_>>
Analogous to slice::first_mut()
Sourcefn last_mut(&mut self) -> Option<Self::RefMut<'_>>
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.