Skip to main content

TryMorph

Trait TryMorph 

Source
pub trait TryMorph<A> {
    type Outcome;

    // Required method
    fn try_morph(a: A) -> Result<Self::Outcome, ()>;
}
Expand description

Extensible conversion trait. Generic over only source type, with destination type being associated.

Required Associated Types§

Source

type Outcome

The type into which A is mutated.

Required Methods§

Source

fn try_morph(a: A) -> Result<Self::Outcome, ()>

Make conversion.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<L: TypedGet, M> TryMorph<<L as TypedGet>::Type> for MorphWithUpperLimit<L, M>
where L::Type: Ord, M: TryMorph<L::Type, Outcome = L::Type>,

Source§

impl<N: TypedGet> TryMorph<<N as TypedGet>::Type> for CheckedReduceBy<N>
where N::Type: CheckedSub,

Source§

impl<N: TypedGet> TryMorph<<N as TypedGet>::Type> for ReduceBy<N>
where N::Type: CheckedSub + Zero,

Source§

impl<T, A: TryInto<T>> TryMorph<A> for TryMorphInto<T>

Source§

impl<T> TryMorph<T> for Identity

A structure that performs identity conversion.

Source§

impl<V: Default, X> TryMorph<X> for ReplaceWithDefault<V>

Source§

impl<V: TypedGet, X> TryMorph<X> for Replace<V>