pub struct NestedArray<T, S, M, N> { /* private fields */ }
Expand description
An Array
implemented as an array of arrays.
It contains a main Array
of type M
. Each element (nested array) of the main array is an
Array
of type N
. The type of the elements of the nested arrays is T
.
This type offers a flatted view of the elements in the nested arrays. Each time an element at a
specified index is accessed, the index is decomposed in two indices (using S: Split
), the
first one is used to index the main array and the second one to index the nested array.
This type is interesting to implemented copy on write arrays. See CowNestedArray
.
Trait Implementations§
Source§impl<T, S, M, N> Array<T> for NestedArray<T, S, M, N>
impl<T, S, M, N> Array<T> for NestedArray<T, S, M, N>
Source§fn with_value(value: T, n: usize) -> Selfwhere
T: Clone,
fn with_value(value: T, n: usize) -> Selfwhere
T: Clone,
Creates a new array with
n
repeated value
.Source§unsafe fn get_unchecked(&self, index: usize) -> &T
unsafe fn get_unchecked(&self, index: usize) -> &T
Returns a reference to the element of the array at
index
, without doing bounds checking.Source§unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut T
unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut T
Returns a mutable reference to the element of the array at
index
, without doing bounds
checking.Source§fn contains(&self, value: &T) -> boolwhere
T: PartialEq,
fn contains(&self, value: &T) -> boolwhere
T: PartialEq,
Returns
true
if the array contains value
, false
otherwise.Source§fn get(&self, index: usize) -> Option<&T>
fn get(&self, index: usize) -> Option<&T>
Returns a reference to the element of the array at
index
, or None
if the index is out
of bounds.Source§impl<T: Clone, S: Clone, M: Clone, N: Clone> Clone for NestedArray<T, S, M, N>
impl<T: Clone, S: Clone, M: Clone, N: Clone> Clone for NestedArray<T, S, M, N>
Source§fn clone(&self) -> NestedArray<T, S, M, N>
fn clone(&self) -> NestedArray<T, S, M, N>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T, S, M, N> DynamicArray<T> for NestedArray<T, S, M, N>
impl<T, S, M, N> DynamicArray<T> for NestedArray<T, S, M, N>
Source§fn with_capacity(capacity: usize) -> Selfwhere
Self: Sized,
fn with_capacity(capacity: usize) -> Selfwhere
Self: Sized,
Creates a array with the specified capacity. Read more
Source§fn reserve(&mut self, additional: usize)
fn reserve(&mut self, additional: usize)
Reserve capacity for at least
additional
more elements. Read moreSource§unsafe fn push_unchecked(&mut self, value: T)
unsafe fn push_unchecked(&mut self, value: T)
Write value to the end of the array and increment the length. Read more
Source§fn extend<I>(&mut self, iter: I)where
Self: Sized,
I: IntoIterator<Item = T>,
fn extend<I>(&mut self, iter: I)where
Self: Sized,
I: IntoIterator<Item = T>,
Appends all elements of
iter
to the array. Read moreSource§impl<T, S, M, N> Index<usize> for NestedArray<T, S, M, N>
impl<T, S, M, N> Index<usize> for NestedArray<T, S, M, N>
Auto Trait Implementations§
impl<T, S, M, N> Freeze for NestedArray<T, S, M, N>
impl<T, S, M, N> RefUnwindSafe for NestedArray<T, S, M, N>
impl<T, S, M, N> Send for NestedArray<T, S, M, N>
impl<T, S, M, N> Sync for NestedArray<T, S, M, N>
impl<T, S, M, N> Unpin for NestedArray<T, S, M, N>
impl<T, S, M, N> UnwindSafe for NestedArray<T, S, M, N>
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