Trait hybrid_array::ArrayOps
source · [−]pub trait ArrayOps<T, const N: usize>: AsRef<[T; N]> + AsMut<[T; N]> + Borrow<[T; N]> + BorrowMut<[T; N]> + From<[T; N]> + Index<usize> + Index<Range<usize>> + IndexMut<usize> + IndexMut<Range<usize>> + IntoIterator + Sized {
type Size: ArraySize<T>;
const SIZE: usize;
fn as_array_ref(&self) -> &[T; N];
fn as_array_mut(&mut self) -> &mut [T; N];
fn from_core_array(arr: [T; N]) -> Self;
fn from_slice(slice: &[T]) -> Result<Self, TryFromSliceError>
where
T: Copy;
fn map<F, U>(self, f: F) -> [U; N]
where
F: FnMut(T) -> U;
fn from_fn<F>(cb: F) -> Self
where
F: FnMut(usize) -> T,
{ ... }
fn iter(&self) -> Iter<'_, T> { ... }
fn iter_mut(&mut self) -> IterMut<'_, T> { ... }
}
Expand description
Array operations which are const generic over a given array size.
Required Associated Types
Required Associated Constants
Size of an array as a usize
.
Not to be confused with ArrayOps::Size
, which is typenum
-based.
Required Methods
fn as_array_ref(&self) -> &[T; N]
fn as_array_ref(&self) -> &[T; N]
Returns a reference to the inner array.
fn as_array_mut(&mut self) -> &mut [T; N]
fn as_array_mut(&mut self) -> &mut [T; N]
Returns a mutable reference to the inner array.
fn from_core_array(arr: [T; N]) -> Self
fn from_core_array(arr: [T; N]) -> Self
Create array from Rust’s core array type.
fn from_slice(slice: &[T]) -> Result<Self, TryFromSliceError> where
T: Copy,
fn from_slice(slice: &[T]) -> Result<Self, TryFromSliceError> where
T: Copy,
Create array from a slice.
Provided Methods
Create array where each array element T
is returned by the cb
call.