Struct fera_array::NestedArray
source · 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
sourceimpl<T, S, M, N> Array<T> for NestedArray<T, S, M, N>where
S: Split,
M: Array<N>,
N: Array<T> + Clone,
impl<T, S, M, N> Array<T> for NestedArray<T, S, M, N>where
S: Split,
M: Array<N>,
N: Array<T> + Clone,
sourcefn 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
.sourceunsafe 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.sourceunsafe 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. Read moresourcefn 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. Read moresourceimpl<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>
sourcefn 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 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<T, S, M, N> DynamicArray<T> for NestedArray<T, S, M, N>where
S: Split,
M: DynamicArray<N>,
N: DynamicArray<T> + Clone,
impl<T, S, M, N> DynamicArray<T> for NestedArray<T, S, M, N>where
S: Split,
M: DynamicArray<N>,
N: DynamicArray<T> + Clone,
sourcefn with_capacity(capacity: usize) -> Selfwhere
Self: Sized,
fn with_capacity(capacity: usize) -> Selfwhere
Self: Sized,
Creates a array with the specified capacity. Read more
sourcefn reserve(&mut self, additional: usize)
fn reserve(&mut self, additional: usize)
Reserve capacity for at least
additional
more elements. Read moresourceunsafe 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
sourcefn 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 moreAuto Trait Implementations
impl<T, S, M, N> RefUnwindSafe for NestedArray<T, S, M, N>where
M: RefUnwindSafe,
N: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S, M, N> Send for NestedArray<T, S, M, N>where
M: Send,
N: Send,
S: Send,
T: Send,
impl<T, S, M, N> Sync for NestedArray<T, S, M, N>where
M: Sync,
N: Sync,
S: Sync,
T: Sync,
impl<T, S, M, N> Unpin for NestedArray<T, S, M, N>where
M: Unpin,
N: Unpin,
S: Unpin,
T: Unpin,
impl<T, S, M, N> UnwindSafe for NestedArray<T, S, M, N>where
M: UnwindSafe,
N: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more