Trait DecodeDispatch
pub trait DecodeDispatch: Sized {
// Required method
fn decode_dispatch(input: &mut &[u8]) -> Result<Self, DispatchError>;
}
Expand description
Decodes an ink! dispatch input into a known selector and its expected parameters.
§Note
This trait is automatically implemented for ink! message and constructor decoders.
§Errors
Returns an error if any of the decode steps failed:
InvalidSelector
: The first four bytes could not properly decoded into the selector.UnknownSelector
: The decoded selector did not match any of the expected ones.InvalidParameters
: Failed to decoded the parameters for the selected dispatchable.
The other dispatch errors are handled by other structures usually.
§Usage
todo: previous doc test used a contract instance, it was in the ink!
crate.
Required Methods§
fn decode_dispatch(input: &mut &[u8]) -> Result<Self, DispatchError>
fn decode_dispatch(input: &mut &[u8]) -> Result<Self, DispatchError>
todo: docs
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.