Trait model_mapper::with::TypeFallibleMapper

source ·
pub trait TypeFallibleMapper<F, I> {
    type Error;

    // Required method
    fn try_map(from: F) -> Result<I, Self::Error>;

    // Provided methods
    fn try_map_wrapped<W>(
        from: W,
    ) -> Result<<W as Wrapper<F>>::Wrapper<I>, Self::Error>
       where W: Wrapper<F> { ... }
    fn try_map_nested_wrapped<NW, W>(
        from: NW,
    ) -> Result<<NW as NestedWrapper<W, F>>::NestedWrapper<I>, Self::Error>
       where NW: NestedWrapper<W, F>,
             W: Wrapper<F> { ... }
    fn try_map_into_option(from: F) -> Result<Option<I>, Self::Error> { ... }
    fn try_map_wrapped_into_option<W>(
        from: W,
    ) -> Result<Option<<W as Wrapper<F>>::Wrapper<I>>, Self::Error>
       where W: Wrapper<F> { ... }
    fn try_map_nested_wrapped_into_option<NW, W>(
        from: NW,
    ) -> Result<Option<<NW as NestedWrapper<W, F>>::NestedWrapper<I>>, Self::Error>
       where NW: NestedWrapper<W, F>,
             W: Wrapper<F> { ... }
    fn try_map_removing_option(from: Option<F>) -> Result<I, MapperError>
       where Self::Error: Error + Send + Sync + 'static { ... }
    fn try_map_wrapped_removing_option<W>(
        from: Option<W>,
    ) -> Result<<W as Wrapper<F>>::Wrapper<I>, MapperError>
       where W: Wrapper<F>,
             Self::Error: Error + Send + Sync + 'static { ... }
    fn try_map_nested_wrapped_removing_option<NW, W>(
        from: Option<NW>,
    ) -> Result<<NW as NestedWrapper<W, F>>::NestedWrapper<I>, MapperError>
       where NW: NestedWrapper<W, F>,
             W: Wrapper<F>,
             Self::Error: Error + Send + Sync + 'static { ... }
}
Expand description

Trait to try to map between types

Required Associated Types§

Required Methods§

source

fn try_map(from: F) -> Result<I, Self::Error>

Maps between types

Provided Methods§

source

fn try_map_wrapped<W>( from: W, ) -> Result<<W as Wrapper<F>>::Wrapper<I>, Self::Error>
where W: Wrapper<F>,

Maps between Wrapper types

source

fn try_map_nested_wrapped<NW, W>( from: NW, ) -> Result<<NW as NestedWrapper<W, F>>::NestedWrapper<I>, Self::Error>
where NW: NestedWrapper<W, F>, W: Wrapper<F>,

Maps between Wrapper types

source

fn try_map_into_option(from: F) -> Result<Option<I>, Self::Error>

Maps encapsulating into an Option

source

fn try_map_wrapped_into_option<W>( from: W, ) -> Result<Option<<W as Wrapper<F>>::Wrapper<I>>, Self::Error>
where W: Wrapper<F>,

Maps a Wrapper encapsulating into an Option

source

fn try_map_nested_wrapped_into_option<NW, W>( from: NW, ) -> Result<Option<<NW as NestedWrapper<W, F>>::NestedWrapper<I>>, Self::Error>
where NW: NestedWrapper<W, F>, W: Wrapper<F>,

Maps a nested Wrapper encapsulating into an Option

source

fn try_map_removing_option(from: Option<F>) -> Result<I, MapperError>
where Self::Error: Error + Send + Sync + 'static,

Maps removing an Option

source

fn try_map_wrapped_removing_option<W>( from: Option<W>, ) -> Result<<W as Wrapper<F>>::Wrapper<I>, MapperError>
where W: Wrapper<F>, Self::Error: Error + Send + Sync + 'static,

Maps a wrapped type removing an Option

source

fn try_map_nested_wrapped_removing_option<NW, W>( from: Option<NW>, ) -> Result<<NW as NestedWrapper<W, F>>::NestedWrapper<I>, MapperError>
where NW: NestedWrapper<W, F>, W: Wrapper<F>, Self::Error: Error + Send + Sync + 'static,

Maps a nested wrapped type removing an Option

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<F, I> TypeFallibleMapper<F, I> for TryIntoMapper
where F: TryInto<I>,

§

type Error = <F as TryInto<I>>::Error