pub trait Decode: Sized {
// Required method
fn decode(decoder: &mut impl Decoder) -> Result<Self, DecodeError>;
// Provided method
fn decode_trailing(
decoder: &mut impl Decoder,
) -> Result<Option<Self>, DecodeError> { ... }
}Expand description
Deserializes a value from an OpenTimestamps-compatible byte stream.
Required Methods§
fn decode(decoder: &mut impl Decoder) -> Result<Self, DecodeError>
Provided Methods§
Sourcefn decode_trailing(
decoder: &mut impl Decoder,
) -> Result<Option<Self>, DecodeError>
fn decode_trailing( decoder: &mut impl Decoder, ) -> Result<Option<Self>, DecodeError>
Decodes a trailing optional value implementing the Decode trait.
This treats any UnexpectedEof error as an indication that the value is absent, returning Ok(None).
If the implementor returns UnexpectedEof for any reason other than the absence of the value,
it should also override this method to avoid masking the error as Ok(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.