Trait EnsureOrigin
pub trait EnsureOrigin<OuterOrigin> {
type Success;
// Required methods
fn try_origin(o: OuterOrigin) -> Result<Self::Success, OuterOrigin>;
fn try_successful_origin() -> Result<OuterOrigin, ()>;
// Provided methods
fn ensure_origin(o: OuterOrigin) -> Result<Self::Success, BadOrigin> { ... }
fn ensure_origin_or_root(
o: OuterOrigin,
) -> Result<Option<Self::Success>, BadOrigin>
where OuterOrigin: OriginTrait { ... }
fn try_origin_or_root(
o: OuterOrigin,
) -> Result<Option<Self::Success>, OuterOrigin>
where OuterOrigin: OriginTrait { ... }
}
Expand description
Some sort of check on the origin is performed by this object.
Required Associated Types§
type Success
type Success
A return type.
Required Methods§
fn try_origin(o: OuterOrigin) -> Result<Self::Success, OuterOrigin>
fn try_origin(o: OuterOrigin) -> Result<Self::Success, OuterOrigin>
Perform the origin check.
fn try_successful_origin() -> Result<OuterOrigin, ()>
fn try_successful_origin() -> 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§
fn ensure_origin(o: OuterOrigin) -> Result<Self::Success, BadOrigin>
fn ensure_origin(o: OuterOrigin) -> Result<Self::Success, BadOrigin>
Perform the origin check.
fn ensure_origin_or_root(
o: OuterOrigin,
) -> Result<Option<Self::Success>, BadOrigin>where
OuterOrigin: OriginTrait,
fn ensure_origin_or_root(
o: OuterOrigin,
) -> Result<Option<Self::Success>, BadOrigin>where
OuterOrigin: OriginTrait,
The same as ensure_origin
except that Root origin will always pass. This can only be
used if Success
has a sensible impl of Default
since that will be used in the result.
fn try_origin_or_root(
o: OuterOrigin,
) -> Result<Option<Self::Success>, OuterOrigin>where
OuterOrigin: OriginTrait,
fn try_origin_or_root(
o: OuterOrigin,
) -> Result<Option<Self::Success>, OuterOrigin>where
OuterOrigin: OriginTrait,
The same as try_origin
except that Root origin will always pass. This can only be
used if Success
has a sensible impl of Default
since that will be used in the result.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.