Trait Map

Source
pub trait Map<T> {
    type Cont<_T: ?Sized>;

    // Required method
    fn map<U, F>(&self, rhs: F) -> Self::Cont<U>
       where F: FnOnce(&T) -> U;
}
Expand description

Map is a trait that allows for mapping over a reference to a type T by applying a function F to it, producing a new type U. The result is wrapped in a container type defined by the implementor of the trait.

Required Associated Types§

Source

type Cont<_T: ?Sized>

The associated type Cont is a higher-kinded type that represents the container that will hold the result of the mapping operation.

Required Methods§

Source

fn map<U, F>(&self, rhs: F) -> Self::Cont<U>
where F: FnOnce(&T) -> U,

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.

Implementors§