pub trait Array<T, const N: usize>:
From<[T; N]>
+ Into<[T; N]>
+ Index<usize, Output = T>
+ IndexMut<usize, Output = T> {
const DIMENSION: usize = N;
// Required methods
fn array(&self) -> &[T; N];
fn array_mut(&mut self) -> &mut [T; N];
// Provided methods
fn splat(value: T) -> Self
where T: Clone { ... }
fn any<P>(&self, p: P) -> bool
where P: FnMut(&T) -> bool { ... }
fn all<P>(&self, p: P) -> bool
where P: FnMut(&T) -> bool { ... }
fn for_each<F>(&self, f: F)
where F: FnMut(&T) { ... }
fn for_each_mut<F>(&mut self, f: F)
where F: FnMut(&mut T) { ... }
fn slice(&self) -> &[T] { ... }
fn slice_mut(&mut self) -> &mut [T] { ... }
fn to_array_with_size<const M: usize>(self) -> [T; M]
where T: Default { ... }
fn to_array_with_size_filled_with_value<const M: usize>(
self,
fill: T,
) -> [T; M]
where T: Clone { ... }
}Expand description
An array that is indexable, without any information if the type and the size are generic. Check ArrayWithGenericType and ArrayWithGenericSize for editable generic type.
Provided Associated Constants§
Required Methods§
Provided Methods§
fn splat(value: T) -> Selfwhere
T: Clone,
fn for_each<F>(&self, f: F)
fn for_each_mut<F>(&mut self, f: F)
fn slice(&self) -> &[T]
fn slice_mut(&mut self) -> &mut [T]
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.