Type Alias frame_support::dispatch::DispatchResult
source · pub type DispatchResult = Result<(), DispatchError>;
Expand description
Unaugmented version of DispatchResultWithPostInfo
that can be returned from
dispatchable functions and is automatically converted to the augmented type. Should be
used whenever the PostDispatchInfo
does not need to be overwritten. As this should
be the common case it is the implicit return type when none is specified.
Aliased Type§
enum DispatchResult {
Ok(()),
Err(DispatchError),
}
Variants§
Trait Implementations§
source§impl<T, E> Decode for Result<T, E>where
T: Decode,
E: Decode,
impl<T, E> Decode for Result<T, E>where T: Decode, E: Decode,
source§fn decode<I>(input: &mut I) -> Result<Result<T, E>, Error>where
I: Input,
fn decode<I>(input: &mut I) -> Result<Result<T, E>, Error>where I: Input,
Attempt to deserialise the value from input.
source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self> ) -> Result<DecodeFinished, Error>where I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
source§impl<T, E: Debug> Defensive<T> for Result<T, E>
impl<T, E: Debug> Defensive<T> for Result<T, E>
source§fn defensive_unwrap_or(self, or: T) -> T
fn defensive_unwrap_or(self, or: T) -> T
Exactly the same as
unwrap_or
, but it does the defensive warnings explained in the trait
docs.source§fn defensive_unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T
fn defensive_unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T
Exactly the same as
unwrap_or_else
, but it does the defensive warnings explained in the
trait docs.source§fn defensive_unwrap_or_default(self) -> Twhere
T: Default,
fn defensive_unwrap_or_default(self) -> Twhere T: Default,
Exactly the same as
unwrap_or_default
, but it does the defensive warnings explained in the
trait docs.source§fn defensive(self) -> Self
fn defensive(self) -> Self
Does not alter the inner value at all, but it will log warnings if the inner value is
None
or Err
. Read moresource§fn defensive_proof(self, proof: &'static str) -> Self
fn defensive_proof(self, proof: &'static str) -> Self
Same as
Defensive::defensive
, but it takes a proof as input, and displays it if the
defensive operation has been triggered.source§impl<T, E: Debug> DefensiveResult<T, E> for Result<T, E>
impl<T, E: Debug> DefensiveResult<T, E> for Result<T, E>
source§fn defensive_map_err<F, O: FnOnce(E) -> F>(self, o: O) -> Result<T, F>
fn defensive_map_err<F, O: FnOnce(E) -> F>(self, o: O) -> Result<T, F>
Defensively map the error into another return type, but you are really sure that this
conversion should never be needed.
source§fn defensive_map_or_else<U, D: FnOnce(E) -> U, F: FnOnce(T) -> U>(
self,
default: D,
f: F
) -> U
fn defensive_map_or_else<U, D: FnOnce(E) -> U, F: FnOnce(T) -> U>( self, default: D, f: F ) -> U
Defensively map and unpack the value to something else (
U
), or call the default callback
if Err
, which should never happen.source§fn defensive_ok(self) -> Option<T>
fn defensive_ok(self) -> Option<T>
Defensively transform this result into an option, discarding the
Err
variant if it
happens, which should never happen.source§fn defensive_map<U, F: FnOnce(T) -> U>(self, f: F) -> Result<U, E>
fn defensive_map<U, F: FnOnce(T) -> U>(self, f: F) -> Result<U, E>
Exactly the same as
map
, but it prints the appropriate warnings if the value being mapped
is Err
.source§impl<T, E> Encode for Result<T, E>where
T: Encode,
E: Encode,
impl<T, E> Encode for Result<T, E>where T: Encode, E: Encode,
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
source§fn encode_to<W>(&self, dest: &mut W)where
W: Output + ?Sized,
fn encode_to<W>(&self, dest: &mut W)where W: Output + ?Sized,
Convert self to a slice and append it to the destination.
source§fn using_encoded<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&[u8]) -> R,
fn using_encoded<R, F>(&self, f: F) -> Rwhere F: FnOnce(&[u8]) -> R,
Convert self to a slice and then invoke the given closure with it.
source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
source§impl<T, E> MaxEncodedLen for Result<T, E>where
T: MaxEncodedLen,
E: MaxEncodedLen,
impl<T, E> MaxEncodedLen for Result<T, E>where T: MaxEncodedLen, E: MaxEncodedLen,
source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Upper bound, in bytes, of the maximum encoded size of this item.
source§impl<T: PalletError, E: PalletError> PalletError for Result<T, E>
impl<T: PalletError, E: PalletError> PalletError for Result<T, E>
source§const MAX_ENCODED_SIZE: usize = _
const MAX_ENCODED_SIZE: usize = _
The maximum encoded size for the implementing type. Read more