Trait triangulate::Mappable

source ·
pub trait Mappable<T> {
    type Output<U>;

    // Required method
    fn map<F: Fn(T) -> U, U>(self, f: F) -> Self::Output<U>;
}
Expand description

A type which can map its members of type T to other types (e.g. [usize; 2] is Mappable over usize to produce [u16; 2], [u32; 2], etc.)

It is recommended to not import this trait directly since it has a blanket implementation which will conflict with other map functions.

Required Associated Types§

source

type Output<U>

The resulting type when T is mapped to U

Required Methods§

source

fn map<F: Fn(T) -> U, U>(self, f: F) -> Self::Output<U>

Uses function f to map all associated T types to U

Implementations on Foreign Types§

source§

impl<T> Mappable<T> for (T, T, T)

§

type Output<U> = (U, U, U)

source§

fn map<F: Fn(T) -> U, U>(self, f: F) -> Self::Output<U>

source§

impl<T> Mappable<T> for (T, T)

§

type Output<U> = (U, U)

source§

fn map<F: Fn(T) -> U, U>(self, f: F) -> Self::Output<U>

source§

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

§

type Output<U> = [U; N]

source§

fn map<F: Fn(T) -> U, U>(self, f: F) -> Self::Output<U>

source§

impl<T> Mappable<T> for Vec<T>

§

type Output<U> = Vec<U, Global>

source§

fn map<F: Fn(T) -> U, U>(self, f: F) -> Self::Output<U>

Implementors§

source§

impl<T> Mappable<T> for T

§

type Output<U> = U