pub trait CircularArrayMut<const N: usize, T, El> {
// Required methods
fn push_front(&mut self, axis: usize, el: El);
fn push_front_raw(&mut self, axis: usize, el: El);
fn push_back(&mut self, axis: usize, el: El);
fn push_back_raw(&mut self, axis: usize, el: El);
}Expand description
Mutating CircularArray operations.
Required Methods§
Sourcefn push_front(&mut self, axis: usize, el: El)
fn push_front(&mut self, axis: usize, el: El)
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.
§Example
let offset = [1, 0];
let elements = [0, 1, 2, 3, 4, 5, 6, 7, 8].to_vec();
let mut array = CircularArray::new_offset([3, 3], elements, offset);
array.push_front(1, &[9, 10, 11]);
assert_eq!(array.iter_raw().cloned().collect::<Vec<_>>(), &[
11, 9, 10,
3, 4, 5,
6, 7, 8,
]);Sourcefn push_front_raw(&mut self, axis: usize, el: El)
fn push_front_raw(&mut self, axis: usize, el: El)
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.
§Example
let offset = [1, 0];
let elements = [0, 1, 2, 3, 4, 5, 6, 7, 8].to_vec();
let mut array = CircularArray::new_offset([3, 3], elements, offset);
array.push_front_raw(1, &[9, 10, 11]);
assert_eq!(array.iter_raw().cloned().collect::<Vec<_>>(), &[
9, 10, 11,
3, 4, 5,
6, 7, 8,
]);Sourcefn push_back(&mut self, axis: usize, el: El)
fn push_back(&mut self, axis: usize, el: El)
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.
§Example
let offset = [1, 0];
let elements = [0, 1, 2, 3, 4, 5, 6, 7, 8].to_vec();
let mut array = CircularArray::new_offset([3, 3], elements, offset);
array.push_back(1, &[9, 10, 11]);
assert_eq!(array.iter_raw().cloned().collect::<Vec<_>>(), &[
0, 1, 2,
3, 4, 5,
11, 9, 10,
]);Sourcefn push_back_raw(&mut self, axis: usize, el: El)
fn push_back_raw(&mut self, axis: usize, el: El)
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.
§Example
let offset = [1, 0];
let elements = [0, 1, 2, 3, 4, 5, 6, 7, 8].to_vec();
let mut array = CircularArray::new_offset([3, 3], elements, offset);
array.push_back_raw(1, &[9, 10, 11]);
assert_eq!(array.iter_raw().cloned().collect::<Vec<_>>(), &[
0, 1, 2,
3, 4, 5,
9, 10, 11,
]);