Trait ArrayMap

Source
pub trait ArrayMap<U>: Array {
    type Map: Array<Item = U>;

    // Provided method
    fn map<F>(self, f: F) -> Self::Map
       where F: FnMut(Self::Item) -> U { ... }
}
Expand description

Represent array which elements can be mapped (actually any array)

Required Associated Types§

Source

type Map: Array<Item = U>

Type of mapped array. So if Self = [T; N] then Map = [U; N] i.e.

[T; 4]: ArrayMap<U, Map = [U; 4]>

Provided Methods§

Source

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

Maps elements of the array

§Examples
use arraylib::ArrayMap;

let arr = [1, 2, 3, 4, 5];
let res = arr.map(|x| 2i32.pow(x));
assert_eq!(res, [2, 4, 8, 16, 32])

NOTE: it’s nighly recommended to use iterators when you need to perform more that one operation (e.g. map + as_ref) because iterators are lazy and ArrayMap isn’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, U> ArrayMap<U> for [T; 0]

Source§

type Map = [U; 0]

Source§

fn map<F>(self, _f: F) -> Self::Map
where F: FnMut(Self::Item) -> U,

Source§

impl<T, U> ArrayMap<U> for [T; 1]

Source§

impl<T, U> ArrayMap<U> for [T; 2]

Source§

impl<T, U> ArrayMap<U> for [T; 3]

Source§

impl<T, U> ArrayMap<U> for [T; 4]

Source§

impl<T, U> ArrayMap<U> for [T; 5]

Source§

impl<T, U> ArrayMap<U> for [T; 6]

Source§

impl<T, U> ArrayMap<U> for [T; 7]

Source§

impl<T, U> ArrayMap<U> for [T; 8]

Source§

impl<T, U> ArrayMap<U> for [T; 9]

Source§

impl<T, U> ArrayMap<U> for [T; 10]

Source§

impl<T, U> ArrayMap<U> for [T; 11]

Source§

impl<T, U> ArrayMap<U> for [T; 12]

Source§

impl<T, U> ArrayMap<U> for [T; 13]

Source§

impl<T, U> ArrayMap<U> for [T; 14]

Source§

impl<T, U> ArrayMap<U> for [T; 15]

Source§

impl<T, U> ArrayMap<U> for [T; 16]

Source§

impl<T, U> ArrayMap<U> for [T; 17]

Source§

impl<T, U> ArrayMap<U> for [T; 18]

Source§

impl<T, U> ArrayMap<U> for [T; 19]

Source§

impl<T, U> ArrayMap<U> for [T; 20]

Source§

impl<T, U> ArrayMap<U> for [T; 21]

Source§

impl<T, U> ArrayMap<U> for [T; 22]

Source§

impl<T, U> ArrayMap<U> for [T; 23]

Source§

impl<T, U> ArrayMap<U> for [T; 24]

Source§

impl<T, U> ArrayMap<U> for [T; 25]

Source§

impl<T, U> ArrayMap<U> for [T; 26]

Source§

impl<T, U> ArrayMap<U> for [T; 27]

Source§

impl<T, U> ArrayMap<U> for [T; 28]

Source§

impl<T, U> ArrayMap<U> for [T; 29]

Source§

impl<T, U> ArrayMap<U> for [T; 30]

Source§

impl<T, U> ArrayMap<U> for [T; 31]

Source§

impl<T, U> ArrayMap<U> for [T; 32]

Source§

impl<T, U> ArrayMap<U> for [T; 33]

Source§

impl<T, U> ArrayMap<U> for [T; 34]

Source§

impl<T, U> ArrayMap<U> for [T; 35]

Source§

impl<T, U> ArrayMap<U> for [T; 36]

Source§

impl<T, U> ArrayMap<U> for [T; 37]

Source§

impl<T, U> ArrayMap<U> for [T; 38]

Source§

impl<T, U> ArrayMap<U> for [T; 39]

Source§

impl<T, U> ArrayMap<U> for [T; 40]

Source§

impl<T, U> ArrayMap<U> for [T; 41]

Source§

impl<T, U> ArrayMap<U> for [T; 42]

Source§

impl<T, U> ArrayMap<U> for [T; 43]

Source§

impl<T, U> ArrayMap<U> for [T; 44]

Source§

impl<T, U> ArrayMap<U> for [T; 45]

Source§

impl<T, U> ArrayMap<U> for [T; 46]

Source§

impl<T, U> ArrayMap<U> for [T; 47]

Source§

impl<T, U> ArrayMap<U> for [T; 48]

Source§

impl<T, U> ArrayMap<U> for [T; 49]

Source§

impl<T, U> ArrayMap<U> for [T; 50]

Source§

impl<T, U> ArrayMap<U> for [T; 51]

Source§

impl<T, U> ArrayMap<U> for [T; 52]

Source§

impl<T, U> ArrayMap<U> for [T; 53]

Source§

impl<T, U> ArrayMap<U> for [T; 54]

Source§

impl<T, U> ArrayMap<U> for [T; 55]

Source§

impl<T, U> ArrayMap<U> for [T; 56]

Source§

impl<T, U> ArrayMap<U> for [T; 57]

Source§

impl<T, U> ArrayMap<U> for [T; 58]

Source§

impl<T, U> ArrayMap<U> for [T; 59]

Source§

impl<T, U> ArrayMap<U> for [T; 60]

Source§

impl<T, U> ArrayMap<U> for [T; 61]

Source§

impl<T, U> ArrayMap<U> for [T; 62]

Source§

impl<T, U> ArrayMap<U> for [T; 63]

Source§

impl<T, U> ArrayMap<U> for [T; 64]

Source§

impl<T, U> ArrayMap<U> for [T; 65]

Source§

impl<T, U> ArrayMap<U> for [T; 66]

Source§

impl<T, U> ArrayMap<U> for [T; 67]

Source§

impl<T, U> ArrayMap<U> for [T; 68]

Source§

impl<T, U> ArrayMap<U> for [T; 69]

Source§

impl<T, U> ArrayMap<U> for [T; 70]

Source§

impl<T, U> ArrayMap<U> for [T; 71]

Source§

impl<T, U> ArrayMap<U> for [T; 72]

Source§

impl<T, U> ArrayMap<U> for [T; 73]

Source§

impl<T, U> ArrayMap<U> for [T; 74]

Source§

impl<T, U> ArrayMap<U> for [T; 75]

Source§

impl<T, U> ArrayMap<U> for [T; 76]

Source§

impl<T, U> ArrayMap<U> for [T; 77]

Source§

impl<T, U> ArrayMap<U> for [T; 78]

Source§

impl<T, U> ArrayMap<U> for [T; 79]

Source§

impl<T, U> ArrayMap<U> for [T; 80]

Source§

impl<T, U> ArrayMap<U> for [T; 81]

Source§

impl<T, U> ArrayMap<U> for [T; 82]

Source§

impl<T, U> ArrayMap<U> for [T; 83]

Source§

impl<T, U> ArrayMap<U> for [T; 84]

Source§

impl<T, U> ArrayMap<U> for [T; 85]

Source§

impl<T, U> ArrayMap<U> for [T; 86]

Source§

impl<T, U> ArrayMap<U> for [T; 87]

Source§

impl<T, U> ArrayMap<U> for [T; 88]

Source§

impl<T, U> ArrayMap<U> for [T; 89]

Source§

impl<T, U> ArrayMap<U> for [T; 90]

Source§

impl<T, U> ArrayMap<U> for [T; 91]

Source§

impl<T, U> ArrayMap<U> for [T; 92]

Source§

impl<T, U> ArrayMap<U> for [T; 93]

Source§

impl<T, U> ArrayMap<U> for [T; 94]

Source§

impl<T, U> ArrayMap<U> for [T; 95]

Source§

impl<T, U> ArrayMap<U> for [T; 96]

Source§

impl<T, U> ArrayMap<U> for [T; 97]

Source§

impl<T, U> ArrayMap<U> for [T; 98]

Source§

impl<T, U> ArrayMap<U> for [T; 99]

Source§

impl<T, U> ArrayMap<U> for [T; 100]

Source§

impl<T, U> ArrayMap<U> for [T; 101]

Source§

impl<T, U> ArrayMap<U> for [T; 102]

Source§

impl<T, U> ArrayMap<U> for [T; 103]

Source§

impl<T, U> ArrayMap<U> for [T; 104]

Source§

impl<T, U> ArrayMap<U> for [T; 105]

Source§

impl<T, U> ArrayMap<U> for [T; 106]

Source§

impl<T, U> ArrayMap<U> for [T; 107]

Source§

impl<T, U> ArrayMap<U> for [T; 108]

Source§

impl<T, U> ArrayMap<U> for [T; 109]

Source§

impl<T, U> ArrayMap<U> for [T; 110]

Source§

impl<T, U> ArrayMap<U> for [T; 111]

Source§

impl<T, U> ArrayMap<U> for [T; 112]

Source§

impl<T, U> ArrayMap<U> for [T; 113]

Source§

impl<T, U> ArrayMap<U> for [T; 114]

Source§

impl<T, U> ArrayMap<U> for [T; 115]

Source§

impl<T, U> ArrayMap<U> for [T; 116]

Source§

impl<T, U> ArrayMap<U> for [T; 117]

Source§

impl<T, U> ArrayMap<U> for [T; 118]

Source§

impl<T, U> ArrayMap<U> for [T; 119]

Source§

impl<T, U> ArrayMap<U> for [T; 120]

Source§

impl<T, U> ArrayMap<U> for [T; 121]

Source§

impl<T, U> ArrayMap<U> for [T; 122]

Source§

impl<T, U> ArrayMap<U> for [T; 123]

Source§

impl<T, U> ArrayMap<U> for [T; 124]

Source§

impl<T, U> ArrayMap<U> for [T; 125]

Source§

impl<T, U> ArrayMap<U> for [T; 126]

Source§

impl<T, U> ArrayMap<U> for [T; 127]

Source§

impl<T, U> ArrayMap<U> for [T; 128]

Source§

impl<T, U> ArrayMap<U> for [T; 200]

Source§

impl<T, U> ArrayMap<U> for [T; 256]

Source§

impl<T, U> ArrayMap<U> for [T; 300]

Source§

impl<T, U> ArrayMap<U> for [T; 400]

Source§

impl<T, U> ArrayMap<U> for [T; 500]

Source§

impl<T, U> ArrayMap<U> for [T; 512]

Source§

impl<T, U> ArrayMap<U> for [T; 600]

Source§

impl<T, U> ArrayMap<U> for [T; 700]

Source§

impl<T, U> ArrayMap<U> for [T; 800]

Source§

impl<T, U> ArrayMap<U> for [T; 900]

Source§

impl<T, U> ArrayMap<U> for [T; 1000]

Source§

impl<T, U> ArrayMap<U> for [T; 1024]

Source§

impl<T, U> ArrayMap<U> for [T; 2048]

Source§

impl<T, U> ArrayMap<U> for [T; 4096]

Source§

impl<T, U> ArrayMap<U> for [T; 8192]

Source§

impl<T, U> ArrayMap<U> for [T; 16384]

Source§

impl<T, U> ArrayMap<U> for [T; 32768]

Source§

impl<T, U> ArrayMap<U> for [T; 65536]

Implementors§