Trait model_mapper::with::NestedWrapper

source ·
pub trait NestedWrapper<W: Wrapper<T>, T> {
    type NestedWrapper<U>;

    // Required methods
    fn map_wrapper<Z: Fn(T) -> U, U>(self, f: Z) -> Self::NestedWrapper<U>;
    fn try_map_wrapper<Z: Fn(T) -> Result<U, E>, U, E>(
        self,
        f: Z,
    ) -> Result<Self::NestedWrapper<U>, E>;
}
Expand description

This type abstracts different kinds of wrappers like Option, Vec, etc. when its value is another Wrapper

Required Associated Types§

Required Methods§

source

fn map_wrapper<Z: Fn(T) -> U, U>(self, f: Z) -> Self::NestedWrapper<U>

source

fn try_map_wrapper<Z: Fn(T) -> Result<U, E>, U, E>( self, f: Z, ) -> Result<Self::NestedWrapper<U>, E>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<W: Wrapper<T>, T> NestedWrapper<W, T> for Option<W>

source§

type NestedWrapper<U> = Option<<W as Wrapper<T>>::Wrapper<U>>

source§

fn map_wrapper<Z: Fn(T) -> U, U>(self, f: Z) -> Self::NestedWrapper<U>

source§

fn try_map_wrapper<Z: Fn(T) -> Result<U, E>, U, E>( self, f: Z, ) -> Result<Self::NestedWrapper<U>, E>

source§

impl<W: Wrapper<T>, T> NestedWrapper<W, T> for Vec<W>

source§

type NestedWrapper<U> = Vec<<W as Wrapper<T>>::Wrapper<U>>

source§

fn map_wrapper<Z: Fn(T) -> U, U>(self, f: Z) -> Self::NestedWrapper<U>

source§

fn try_map_wrapper<Z: Fn(T) -> Result<U, E>, U, E>( self, f: Z, ) -> Result<Self::NestedWrapper<U>, E>

source§

impl<W: Wrapper<T>, T, K: Eq + Hash> NestedWrapper<W, T> for HashMap<K, W>

source§

type NestedWrapper<U> = HashMap<K, <W as Wrapper<T>>::Wrapper<U>>

source§

fn map_wrapper<Z: Fn(T) -> U, U>(self, f: Z) -> Self::NestedWrapper<U>

source§

fn try_map_wrapper<Z: Fn(T) -> Result<U, E>, U, E>( self, f: Z, ) -> Result<Self::NestedWrapper<U>, E>

Implementors§