Skip to main content

SupportedArray

Trait SupportedArray 

Source
pub trait SupportedArray<T, const N: usize> {
    // Provided methods
    fn map<U, F>(self, f: F) -> [U; N]
       where Self: Sized,
             F: FnMut(T) -> U { ... }
    fn each_ref(&self) -> [&T; N] { ... }
    fn each_mut(&mut self) -> [&mut T; N] { ... }
}
Expand description

Methods only available on owned arrays [T; N], not on slices.

See the module docs for how to read this trait.

Provided Methods§

Source

fn map<U, F>(self, f: F) -> [U; N]
where Self: Sized, F: FnMut(T) -> U,

Returns a new array where each element is the result of applying f to the corresponding element of self.

Mirrors <[T; N]>::map.

Source

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

Borrows each element and returns a fresh array of references.

Mirrors <[T; N]>::each_ref.

Source

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

Borrows each element mutably and returns a fresh array of references.

Mirrors <[T; N]>::each_mut.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

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

Implementors§