pub trait Decode: Sized {
// Required method
fn decode<I>(input: &mut I) -> Result<Self, Error>
where I: Input;
// Provided methods
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>
where I: Input { ... }
fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input { ... }
fn encoded_fixed_size() -> Option<usize> { ... }
}Expand description
Trait that allows zero-copy read of value-references from slices in LE format.
Required Methods§
Provided Methods§
Sourcefn 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.
The default implementation will just call Decode::decode.
§Safety
If this function returns Ok then dst must be properly initialized.
This is enforced by requiring the implementation to return a DecodeFinished
which can only be created by calling DecodeFinished::assert_decoding_finished which is
unsafe.
Sourcefn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
Attempt to skip the encoded value from input.
The default implementation of this function is just calling Decode::decode.
When possible, an implementation should provide a specialized implementation.
Sourcefn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type.
If it returns Some(size) then all possible values of this
type have the given size (in bytes) when encoded.
NOTE: A type with a fixed encoded size may return None.
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.
Implementations on Foreign Types§
Source§impl Decode for HeaderChainError
impl Decode for HeaderChainError
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<HeaderChainError, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for MessagesOperatingMode
impl Decode for MessagesOperatingMode
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<MessagesOperatingMode, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for VerificationError
impl Decode for VerificationError
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<VerificationError, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for BasicOperatingMode
impl Decode for BasicOperatingMode
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<BasicOperatingMode, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for OwnedBridgeModuleError
impl Decode for OwnedBridgeModuleError
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<OwnedBridgeModuleError, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for StorageProofError
impl Decode for StorageProofError
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<StorageProofError, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for XcmBridgeHubRouterCall
impl Decode for XcmBridgeHubRouterCall
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<XcmBridgeHubRouterCall, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for BridgeLocationsError
impl Decode for BridgeLocationsError
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<BridgeLocationsError, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for BridgeState
impl Decode for BridgeState
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<BridgeState, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for ChannelSignal
impl Decode for ChannelSignal
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<ChannelSignal, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for OutboundState
impl Decode for OutboundState
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<OutboundState, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for InboundState
impl Decode for InboundState
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<InboundState, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for AggregateMessageOrigin
impl Decode for AggregateMessageOrigin
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<AggregateMessageOrigin, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for CumulusDigestItem
impl Decode for CumulusDigestItem
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<CumulusDigestItem, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for MessageSendError
impl Decode for MessageSendError
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<MessageSendError, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for ServiceQuality
impl Decode for ServiceQuality
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<ServiceQuality, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for RuntimeMetadata
impl Decode for RuntimeMetadata
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<RuntimeMetadata, Error>where
__CodecInputEdqy: Input,
Source§impl Decode for RuntimeMetadataDeprecated
Available on crate feature decode only.
impl Decode for RuntimeMetadataDeprecated
decode only.