sp_runtime::traits

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.

Object Safety§

This trait is not object safe.

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> TryMorph<T> for Identity

A structure that performs identity conversion.

source§

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

source§

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

source§

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