Trait Map

Source
pub trait Map<T1> {
    type Target<T2>;

    // Required method
    fn map_box<T2>(self, f: impl FnMut(T1) -> T2) -> Self::Target<T2>;
}

Required Associated Types§

Source

type Target<T2>

Required Methods§

Source

fn map_box<T2>(self, f: impl FnMut(T1) -> T2) -> Self::Target<T2>

Returns a box, with function f applied to the value inside. This function will re-use the allocation when possible.

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<T1> Map<T1> for Box<T1>

Source§

fn map_box<T2>(self, f: impl FnMut(T1) -> T2) -> Self::Target<T2>

Returns a box, with function f applied to the value inside. This function will re-use the allocation when possible.

Source§

type Target<T2> = Box<T2>

Implementors§