pub struct CircularArray<const N: usize, A, T> { /* private fields */ }Expand description
A circular array of D dimensions holding elements of type T.
Implementations§
Source§impl<const N: usize, A, T> CircularArray<N, A, T>
impl<const N: usize, A, T> CircularArray<N, A, T>
pub fn new(shape: [usize; N], array: A) -> CircularArray<N, A, T>
pub fn new_offset( shape: [usize; N], array: A, offset: [usize; N], ) -> CircularArray<N, A, T>
Sourcepub fn slice_len(&self, axis: usize) -> usize
pub fn slice_len(&self, axis: usize) -> usize
Get the number of elements for a single slice of the array, for the given
axis. Pushing n slices of elements onto an axis requires n * slice_len
elements to be passed to the respective method.
Sourcepub fn next_offset(&self, axis: usize, n: isize) -> usize
pub fn next_offset(&self, axis: usize, n: isize) -> usize
Get the offset value after adding n to the given axis.
Source§impl<const N: usize, T> CircularArray<N, Vec<T>, T>
impl<const N: usize, T> CircularArray<N, Vec<T>, T>
Trait Implementations§
Source§impl<'a, const N: usize, A: AsRef<[T]>, T: 'a> CircularArrayIndex<'a, N, T> for CircularArray<N, A, T>
impl<'a, const N: usize, A: AsRef<[T]>, T: 'a> CircularArrayIndex<'a, N, T> for CircularArray<N, A, T>
Source§fn iter(&'a self) -> impl Iterator<Item = &'a T>
fn iter(&'a self) -> impl Iterator<Item = &'a T>
Iterate over all elements of the inner array, aligned to the offset.
Source§fn iter_raw(&'a self) -> impl Iterator<Item = &'a T>
fn iter_raw(&'a self) -> impl Iterator<Item = &'a T>
Iterate over all elements of the inner array.
Source§fn iter_index(
&'a self,
axis: usize,
index: usize,
) -> impl Iterator<Item = &'a T>
fn iter_index( &'a self, axis: usize, index: usize, ) -> impl Iterator<Item = &'a T>
Iterate over all elements of
index for the given axis aligned to the offset.Source§fn iter_range(
&'a self,
axis: usize,
range: Range<usize>,
) -> impl Iterator<Item = &'a T>
fn iter_range( &'a self, axis: usize, range: Range<usize>, ) -> impl Iterator<Item = &'a T>
Iterate over all elements of the given index
range for the given axis
aligned to the offset.Source§fn iter_range_raw(
&'a self,
axis: usize,
range: Range<usize>,
) -> impl Iterator<Item = &'a T>
fn iter_range_raw( &'a self, axis: usize, range: Range<usize>, ) -> impl Iterator<Item = &'a T>
Iterate over all elements of the given index
range for the given axis.Source§fn iter_slice(&'a self, slice: [Range<usize>; N]) -> impl Iterator<Item = &'a T>
fn iter_slice(&'a self, slice: [Range<usize>; N]) -> impl Iterator<Item = &'a T>
Iterate over all elements of the given index
slice.Source§fn iter_index_raw(
&'a self,
axis: usize,
index: usize,
) -> impl Iterator<Item = &'a T>
fn iter_index_raw( &'a self, axis: usize, index: usize, ) -> impl Iterator<Item = &'a T>
Iterate over all elements of
index for the given axis.Source§impl<'a, const N: usize, A: AsMut<[T]>, T: 'a> CircularArrayIndexMut<'a, N, T> for CircularArray<N, A, T>
impl<'a, const N: usize, A: AsMut<[T]>, T: 'a> CircularArrayIndexMut<'a, N, T> for CircularArray<N, A, T>
Source§impl<'a, const N: usize, A: AsRef<[T]> + AsMut<[T]>, T: Clone> CircularArrayMut<N, T, &'a [T]> for CircularArray<N, A, T>
impl<'a, const N: usize, A: AsRef<[T]> + AsMut<[T]>, T: Clone> CircularArrayMut<N, T, &'a [T]> for CircularArray<N, A, T>
Source§fn push_front(&mut self, axis: usize, el: &'a [T])
fn push_front(&mut self, axis: usize, el: &'a [T])
Push elements to the front of the given
axis, taking into account the
offsets of all axes. Elements must be an exact multiple of the slice
size for the given axis. See CircularArray::slice_len. Read moreSource§fn push_front_raw(&mut self, axis: usize, el: &'a [T])
fn push_front_raw(&mut self, axis: usize, el: &'a [T])
Push elements to the front of the given
axis, taking into account only
the offset of the given axis. Elements must be an exact multiple of
the slice size for the given axis. See CircularArray::slice_len. Read moreSource§fn push_back(&mut self, axis: usize, el: &'a [T])
fn push_back(&mut self, axis: usize, el: &'a [T])
Push elements to the back of the given
axis, taking into account the
offsets of all exes. Elements must be an exact multiple of the slice
size for the given axis. See CircularArray::slice_len. Read moreSource§fn push_back_raw(&mut self, axis: usize, el: &'a [T])
fn push_back_raw(&mut self, axis: usize, el: &'a [T])
Push elements to the back of the given
axis, taking into account the
offsets of all axes. Elements must be an exact multiple of the slice
size for the given axis. See CircularArray::slice_len. Read moreAuto Trait Implementations§
impl<const N: usize, A, T> Freeze for CircularArray<N, A, T>where
A: Freeze,
impl<const N: usize, A, T> RefUnwindSafe for CircularArray<N, A, T>where
A: RefUnwindSafe,
T: RefUnwindSafe,
impl<const N: usize, A, T> Send for CircularArray<N, A, T>
impl<const N: usize, A, T> Sync for CircularArray<N, A, T>
impl<const N: usize, A, T> Unpin for CircularArray<N, A, T>
impl<const N: usize, A, T> UnwindSafe for CircularArray<N, A, T>where
A: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more