Trait ArrayLike

Source
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 13 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 slice(&self) -> &[T] { ... } fn slice_mut(&mut self) -> &mut [T] { ... }
}

Provided Associated Constants§

Required Associated Types§

Source

type WithType<T2>: ArrayLike<T2, N>

Required Methods§

Source

fn array(&self) -> &[T; N]

Source

fn array_mut(&mut self) -> &mut [T; N]

Provided Methods§

Source

fn splat(value: T) -> Self
where T: Clone,

Source

fn map<U, F>(self, f: F) -> Self::WithType<U>
where F: FnMut(T) -> U,

Source

fn map_with<U, T2, F>( self, other: Self::WithType<T2>, f: F, ) -> Self::WithType<U>
where F: FnMut(T, T2) -> U,

Source

fn any<P>(&self, p: P) -> bool
where P: FnMut(&T) -> bool,

True if the predicate is true for at least one component

Source

fn any_with<T2, P>(&self, other: Self::WithType<T2>, p: P) -> bool
where P: FnMut(&T, &T2) -> bool,

True if the predicate is true for at least one component

Source

fn all<P>(&self, p: P) -> bool
where P: FnMut(&T) -> bool,

True if the predicate is true for all component

Source

fn all_with<T2, P>(&self, other: &Self::WithType<T2>, p: P) -> bool
where P: FnMut(&T, &T2) -> bool,

True if the predicate is true for all component

Source

fn for_each<F>(&self, f: F)
where F: FnMut(&T),

Source

fn for_each_mut<F>(&mut self, f: F)
where F: FnMut(&mut T),

Source

fn slice(&self) -> &[T]

Source

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.

Implementations on Foreign Types§

Source§

impl<T, const N: usize> ArrayLike<T, N> for [T; N]

Source§

type WithType<T2> = [T2; N]

Source§

fn array(&self) -> &[T; N]

Source§

fn array_mut(&mut self) -> &mut [T; N]

Implementors§