pub trait EnsureOriginWithArg<OuterOrigin, Argument> {
    type Success;

    // Required methods
    fn try_origin(
        o: OuterOrigin,
        a: &Argument
    ) -> Result<Self::Success, OuterOrigin>;
    fn try_successful_origin(a: &Argument) -> Result<OuterOrigin, ()>;

    // Provided method
    fn ensure_origin(
        o: OuterOrigin,
        a: &Argument
    ) -> Result<Self::Success, BadOrigin> { ... }
}
Expand description

Some sort of check on the origin is performed by this object.

Required Associated Types§

source

type Success

A return type.

Required Methods§

source

fn try_origin( o: OuterOrigin, a: &Argument ) -> Result<Self::Success, OuterOrigin>

Perform the origin check, returning the origin value if unsuccessful. This allows chaining.

source

fn try_successful_origin(a: &Argument) -> Result<OuterOrigin, ()>

Attempt to get an outer origin capable of passing try_origin check. May return Err if it is impossible.

** Should be used for benchmarking only!!! **

Provided Methods§

source

fn ensure_origin( o: OuterOrigin, a: &Argument ) -> Result<Self::Success, BadOrigin>

Perform the origin check.

Implementors§

source§

impl<O, A, Morph: for<'a> TryMorph<&'a A>, Inner: for<'a> EnsureOriginWithArg<O, <Morph as TryMorph<&'a A>>::Outcome, Success = Success>, Success> EnsureOriginWithArg<O, A> for TryWithMorphedArg<O, A, Morph, Inner, Success>

§

type Success = Success

source§

impl<O, Original: EnsureOriginWithArg<O, A>, Mutator: Morph<Original::Success>, A> EnsureOriginWithArg<O, A> for MapSuccess<Original, Mutator>

§

type Success = <Mutator as Morph<<Original as EnsureOriginWithArg<O, A>>::Success>>::Outcome

source§

impl<O: Clone, Original: EnsureOriginWithArg<O, A>, Mutator: TryMorph<Original::Success>, A> EnsureOriginWithArg<O, A> for TryMapSuccess<Original, Mutator>

§

type Success = <Mutator as TryMorph<<Original as EnsureOriginWithArg<O, A>>::Success>>::Outcome

source§

impl<OO, Success, A> EnsureOriginWithArg<OO, A> for NeverEnsureOrigin<Success>

source§

impl<OuterOrigin, Argument, EO: EnsureOrigin<OuterOrigin>> EnsureOriginWithArg<OuterOrigin, Argument> for AsEnsureOriginWithArg<EO>

§

type Success = <EO as EnsureOrigin<OuterOrigin>>::Success

source§

impl<OuterOrigin, L: EnsureOriginWithArg<OuterOrigin, Argument>, R: EnsureOriginWithArg<OuterOrigin, Argument>, Argument> EnsureOriginWithArg<OuterOrigin, Argument> for EitherOfDiverse<L, R>

§

type Success = Either<<L as EnsureOriginWithArg<OuterOrigin, Argument>>::Success, <R as EnsureOriginWithArg<OuterOrigin, Argument>>::Success>

source§

impl<OuterOrigin, L: EnsureOriginWithArg<OuterOrigin, Argument>, R: EnsureOriginWithArg<OuterOrigin, Argument, Success = L::Success>, Argument> EnsureOriginWithArg<OuterOrigin, Argument> for EitherOf<L, R>

§

type Success = <L as EnsureOriginWithArg<OuterOrigin, Argument>>::Success