[−][src]Trait higher_order_functions::Map
Types containing 'inner' values which can be mapped over.
Examples
Multiplying an array by 2:
use higher_order_functions::Map; let arr = [1, 4, 6, -3, 6].map(|x| x * 2); assert_eq!(arr, [2, 8, 12, -6, 12]);
Converting an i32 array to an f64 array:
use higher_order_functions::Map; let arr = [1, 4, 6, -3, 6].map(f64::from); assert_eq!(arr, [1.0, 4.0, 6.0, -3.0, 6.0]);
Associated Types
type TFrom
The type of values being mapped over.
type TOut
The generic type of the result after mapping.
Required methods
fn map<TTo, F: FnMut(Self::TFrom) -> TTo>(self, f: F) -> Self::TOut
Apply a function to the inner values of this type.
Implementations on Foreign Types
impl<TFrom, const N: usize> Map for [TFrom; N]
[src]
Apply a function to all elements of the array.
type TFrom = TFrom
type TOut = [TTo; N]
fn map<TTo, F: FnMut(TFrom) -> TTo>(self, f: F) -> Self::TOut
[src]
impl<TFrom> Map for Vec<TFrom>
[src]
Apply a function to all elements of the Vec.
type TFrom = TFrom
type TOut = Vec<TTo>
fn map<TTo, F: FnMut(TFrom) -> TTo>(self, f: F) -> Self::TOut
[src]
impl<TKey, TFrom> Map for BTreeMap<TKey, TFrom> where
TKey: Ord,
[src]
TKey: Ord,
Apply a function to all values of the BTreeMap.
type TFrom = TFrom
type TOut = BTreeMap<TKey, TTo>
fn map<TTo, F: FnMut(TFrom) -> TTo>(self, f: F) -> Self::TOut
[src]
impl<TKey, TFrom> Map for HashMap<TKey, TFrom> where
TKey: Hash + Eq,
[src]
TKey: Hash + Eq,
Apply a function to all values of the HashMap.
type TFrom = TFrom
type TOut = HashMap<TKey, TTo>
fn map<TTo, F: FnMut(TFrom) -> TTo>(self, f: F) -> Self::TOut
[src]
impl<TFrom> Map for LinkedList<TFrom>
[src]
Apply a function to all values of the LinkedList.
type TFrom = TFrom
type TOut = LinkedList<TTo>
fn map<TTo, F: FnMut(TFrom) -> TTo>(self, f: F) -> Self::TOut
[src]
impl<TFrom> Map for VecDeque<TFrom>
[src]
Apply a function to all values of the VecDeque.