pub trait Decode {
// Required method
fn decode_ext(
reader: &mut impl Read,
dedupe_decoder: Option<&mut DedupeDecoder>,
) -> Result<Self>
where Self: Sized;
// Provided methods
fn decode_len(reader: &mut impl Read) -> Result<usize> { ... }
fn decode_discriminant(reader: &mut impl Read) -> Result<usize> { ... }
fn decode(reader: &mut impl Read) -> Result<Self>
where Self: Sized { ... }
}Expand description
Trait for types that can be decoded from a binary stream.
Required Methods§
Sourcefn decode_ext(
reader: &mut impl Read,
dedupe_decoder: Option<&mut DedupeDecoder>,
) -> Result<Self>where
Self: Sized,
fn decode_ext(
reader: &mut impl Read,
dedupe_decoder: Option<&mut DedupeDecoder>,
) -> Result<Self>where
Self: Sized,
Decodes Self from reader, optionally using DedupeDecoder.
Provided Methods§
Sourcefn decode_len(reader: &mut impl Read) -> Result<usize>
fn decode_len(reader: &mut impl Read) -> Result<usize>
Decodes a collection length previously encoded with Encode::encode_len.
Sourcefn decode_discriminant(reader: &mut impl Read) -> Result<usize>
fn decode_discriminant(reader: &mut impl Read) -> Result<usize>
Decodes an enum discriminant previously encoded with Encode::encode_discriminant.
The default reads an unsigned varint.
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.