Trait model_mapper::with::TypeMapper

source ·
pub trait TypeMapper<F, I> {
Show 21 methods // Required method fn map(from: F) -> I; // Provided methods fn try_map(from: F) -> Result<I, Infallible> { ... } fn map_wrapped<W>(from: W) -> <W as Wrapper<F>>::Wrapper<I> where W: Wrapper<F> { ... } fn try_map_wrapped<W>( from: W, ) -> Result<<W as Wrapper<F>>::Wrapper<I>, Infallible> where W: Wrapper<F> { ... } fn map_nested_wrapped<NW, W>( from: NW, ) -> <NW as NestedWrapper<W, F>>::NestedWrapper<I> where NW: NestedWrapper<W, F>, W: Wrapper<F> { ... } fn try_map_nested_wrapped<NW, W>( from: NW, ) -> Result<<NW as NestedWrapper<W, F>>::NestedWrapper<I>, Infallible> where NW: NestedWrapper<W, F>, W: Wrapper<F> { ... } fn map_into_option(from: F) -> Option<I> { ... } fn try_map_into_option(from: F) -> Result<Option<I>, Infallible> { ... } fn map_wrapped_into_option<W>( from: W, ) -> Option<<W as Wrapper<F>>::Wrapper<I>> where W: Wrapper<F> { ... } fn try_map_wrapped_into_option<W>( from: W, ) -> Result<Option<<W as Wrapper<F>>::Wrapper<I>>, Infallible> where W: Wrapper<F> { ... } fn map_nested_wrapped_into_option<NW, W>( from: NW, ) -> Option<<NW as NestedWrapper<W, F>>::NestedWrapper<I>> where NW: NestedWrapper<W, F>, W: Wrapper<F> { ... } fn try_map_nested_wrapped_into_option<NW, W>( from: NW, ) -> Result<Option<<NW as NestedWrapper<W, F>>::NestedWrapper<I>>, Infallible> where NW: NestedWrapper<W, F>, W: Wrapper<F> { ... } fn try_map_removing_option(from: Option<F>) -> Result<I, MapperError> { ... } fn map_removing_option_default(from: Option<F>) -> I where I: Default { ... } fn try_map_removing_option_default(from: Option<F>) -> Result<I, Infallible> where I: Default { ... } fn try_map_wrapped_removing_option<W>( from: Option<W>, ) -> Result<<W as Wrapper<F>>::Wrapper<I>, MapperError> where W: Wrapper<F> { ... } fn map_wrapped_removing_option_default<W>( from: Option<W>, ) -> <W as Wrapper<F>>::Wrapper<I> where W: Wrapper<F>, <W as Wrapper<F>>::Wrapper<I>: Default { ... } fn try_map_wrapped_removing_option_default<W>( from: Option<W>, ) -> Result<<W as Wrapper<F>>::Wrapper<I>, Infallible> where W: Wrapper<F>, <W as Wrapper<F>>::Wrapper<I>: Default { ... } 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> { ... } fn map_nested_wrapped_removing_option_default<NW, W>( from: Option<NW>, ) -> <NW as NestedWrapper<W, F>>::NestedWrapper<I> where NW: NestedWrapper<W, F>, W: Wrapper<F>, <NW as NestedWrapper<W, F>>::NestedWrapper<I>: Default { ... } fn try_map_nested_wrapped_removing_option_default<NW, W>( from: Option<NW>, ) -> Result<<NW as NestedWrapper<W, F>>::NestedWrapper<I>, Infallible> where NW: NestedWrapper<W, F>, W: Wrapper<F>, <NW as NestedWrapper<W, F>>::NestedWrapper<I>: Default { ... }
}
Expand description

Trait to map between types

Required Methods§

source

fn map(from: F) -> I

Maps between types

Provided Methods§

source

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

Maps between types

source

fn map_wrapped<W>(from: W) -> <W as Wrapper<F>>::Wrapper<I>
where W: Wrapper<F>,

Maps between Wrapper types

source

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

Maps between Wrapper types

source

fn map_nested_wrapped<NW, W>( from: NW, ) -> <NW as NestedWrapper<W, F>>::NestedWrapper<I>
where NW: NestedWrapper<W, F>, 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>, Infallible>
where NW: NestedWrapper<W, F>, W: Wrapper<F>,

Maps between Wrapper types

source

fn map_into_option(from: F) -> Option<I>

Maps encapsulating into an Option

source

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

Maps encapsulating into an Option

source

fn map_wrapped_into_option<W>(from: W) -> Option<<W as Wrapper<F>>::Wrapper<I>>
where W: Wrapper<F>,

Maps a Wrapper encapsulating into an Option

source

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

Maps a Wrapper encapsulating into an Option

source

fn map_nested_wrapped_into_option<NW, W>( from: NW, ) -> Option<<NW as NestedWrapper<W, F>>::NestedWrapper<I>>
where NW: NestedWrapper<W, F>, W: Wrapper<F>,

Maps a nested 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>>, Infallible>
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>

Maps removing an Option

source

fn map_removing_option_default(from: Option<F>) -> I
where I: Default,

Maps removing an Option, returning a default value if None

source

fn try_map_removing_option_default(from: Option<F>) -> Result<I, Infallible>
where I: Default,

Maps removing an Option, returning a default value if None

source

fn try_map_wrapped_removing_option<W>( from: Option<W>, ) -> Result<<W as Wrapper<F>>::Wrapper<I>, MapperError>
where W: Wrapper<F>,

Maps a wrapped type removing an Option

source

fn map_wrapped_removing_option_default<W>( from: Option<W>, ) -> <W as Wrapper<F>>::Wrapper<I>
where W: Wrapper<F>, <W as Wrapper<F>>::Wrapper<I>: Default,

Maps a wrapped type removing an Option, returning a default value if None

source

fn try_map_wrapped_removing_option_default<W>( from: Option<W>, ) -> Result<<W as Wrapper<F>>::Wrapper<I>, Infallible>
where W: Wrapper<F>, <W as Wrapper<F>>::Wrapper<I>: Default,

Maps a wrapped type removing an Option, returning a default value if None

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>,

Maps a nested wrapped type removing an Option

source

fn map_nested_wrapped_removing_option_default<NW, W>( from: Option<NW>, ) -> <NW as NestedWrapper<W, F>>::NestedWrapper<I>
where NW: NestedWrapper<W, F>, W: Wrapper<F>, <NW as NestedWrapper<W, F>>::NestedWrapper<I>: Default,

Maps a nested wrapped type removing an Option, returning a default value if None

source

fn try_map_nested_wrapped_removing_option_default<NW, W>( from: Option<NW>, ) -> Result<<NW as NestedWrapper<W, F>>::NestedWrapper<I>, Infallible>
where NW: NestedWrapper<W, F>, W: Wrapper<F>, <NW as NestedWrapper<W, F>>::NestedWrapper<I>: Default,

Maps a nested wrapped type removing an Option, returning a default value if None

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<F, I> TypeMapper<F, I> for IntoMapper
where F: Into<I>,

source§

impl<T: ToString> TypeMapper<T, String> for ToStringMapper