pub trait ArrayLike<T, const N: usize>:
From<[T; N]>
+ Into<[T; N]>
+ Index<usize, Output = T>
+ IndexMut<usize, Output = T> {
type WithType<T2>: ArrayLike<T2, N>;
const DIMENSION: usize = N;
Show 26 methods
// 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 map<U, F>(self, f: F) -> Self::WithType<U>
where F: FnMut(T) -> U { ... }
fn map_with<U, T2, F>(
self,
other: Self::WithType<T2>,
f: F,
) -> Self::WithType<U>
where F: FnMut(T, T2) -> U { ... }
fn any<P>(&self, p: P) -> bool
where P: FnMut(&T) -> bool { ... }
fn any_with<T2, P>(&self, other: Self::WithType<T2>, p: P) -> bool
where P: FnMut(&T, &T2) -> bool { ... }
fn all<P>(&self, p: P) -> bool
where P: FnMut(&T) -> bool { ... }
fn all_with<T2, P>(&self, other: &Self::WithType<T2>, p: P) -> bool
where P: FnMut(&T, &T2) -> 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 min_element(&self) -> &T
where T: PartialOrd { ... }
fn max_element(&self) -> &T
where T: PartialOrd { ... }
fn min_element_idx(&self) -> usize
where T: PartialOrd { ... }
fn max_element_idx(&self) -> usize
where T: PartialOrd { ... }
fn slice(&self) -> &[T] { ... }
fn slice_mut(&mut self) -> &mut [T] { ... }
fn have_idx(&self, idx: usize) -> bool { ... }
fn get(&self, idx: usize) -> Option<&T> { ... }
fn get_mut(&mut self, idx: usize) -> Option<&mut T> { ... }
fn set_or_panic(&mut self, idx: usize, val: T) -> &mut Self { ... }
fn set(&mut self, idx: usize, val: T) -> &mut Self { ... }
fn try_set(&mut self, idx: usize, val: T) -> Result<(), T> { ... }
fn with_or_panic(self, idx: usize, val: T) -> Self { ... }
fn with(self, idx: usize, val: T) -> Self { ... }
fn replace(&mut self, idx: usize, val: T) -> T { ... }
}Provided Associated Constants§
Required Associated Types§
Required Methods§
Provided Methods§
fn splat(value: T) -> Selfwhere
T: Clone,
fn map<U, F>(self, f: F) -> Self::WithType<U>where
F: FnMut(T) -> U,
fn map_with<U, T2, F>(
self,
other: Self::WithType<T2>,
f: F,
) -> Self::WithType<U>where
F: FnMut(T, T2) -> U,
Sourcefn any_with<T2, P>(&self, other: Self::WithType<T2>, p: P) -> bool
fn any_with<T2, P>(&self, other: Self::WithType<T2>, p: P) -> bool
True if the predicate is true for at least one component
Sourcefn all_with<T2, P>(&self, other: &Self::WithType<T2>, p: P) -> bool
fn all_with<T2, P>(&self, other: &Self::WithType<T2>, p: P) -> bool
True if the predicate is true for all component
fn for_each<F>(&self, f: F)
fn for_each_mut<F>(&mut self, f: F)
fn min_element(&self) -> &Twhere
T: PartialOrd,
fn max_element(&self) -> &Twhere
T: PartialOrd,
fn min_element_idx(&self) -> usizewhere
T: PartialOrd,
fn max_element_idx(&self) -> usizewhere
T: PartialOrd,
fn slice(&self) -> &[T]
fn slice_mut(&mut self) -> &mut [T]
fn have_idx(&self, idx: usize) -> bool
fn get(&self, idx: usize) -> Option<&T>
fn get_mut(&mut self, idx: usize) -> Option<&mut T>
Sourcefn set_or_panic(&mut self, idx: usize, val: T) -> &mut Self
fn set_or_panic(&mut self, idx: usize, val: T) -> &mut Self
Panics if the component don’t exist
fn try_set(&mut self, idx: usize, val: T) -> Result<(), T>
Sourcefn with_or_panic(self, idx: usize, val: T) -> Self
fn with_or_panic(self, idx: usize, val: T) -> Self
Panics if the component don’t exist
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.