pub trait DecoderExt<'de> {
// Required methods
fn take_slot<T>(&mut self) -> Result<Slot<'de, T>, DecodeError>;
fn take_slice_slot<T>(
&mut self,
len: usize,
) -> Result<Slot<'de, [T]>, DecodeError>;
fn decode_prefix<T>(&mut self) -> Result<T, DecodeError>
where T: Decode<Self, Constraint = ()>;
fn decode_prefix_with_constraint<T>(
&mut self,
constraint: T::Constraint,
) -> Result<T, DecodeError>
where T: Decode<Self>;
fn decode<T>(&mut self) -> Result<T, DecodeError>
where T: Decode<Self, Constraint = ()>;
fn decode_with_constraint<T>(
&mut self,
constraint: T::Constraint,
) -> Result<T, DecodeError>
where T: Decode<Self>;
}Expand description
Extension methods for Decoder.
Required Methods§
Sourcefn take_slot<T>(&mut self) -> Result<Slot<'de, T>, DecodeError>
fn take_slot<T>(&mut self) -> Result<Slot<'de, T>, DecodeError>
Takes enough chunks for a T, returning a Slot of the taken value.
Sourcefn take_slice_slot<T>(
&mut self,
len: usize,
) -> Result<Slot<'de, [T]>, DecodeError>
fn take_slice_slot<T>( &mut self, len: usize, ) -> Result<Slot<'de, [T]>, DecodeError>
Takes enough chunks for a slice of T, returning a Slot of the taken
slice.
Sourcefn decode_prefix<T>(&mut self) -> Result<T, DecodeError>
fn decode_prefix<T>(&mut self) -> Result<T, DecodeError>
Decodes an owned value from the decoder without finishing it.
On success, returns Ok of an owned value. Returns Err if decoding
failed.
Sourcefn decode_prefix_with_constraint<T>(
&mut self,
constraint: T::Constraint,
) -> Result<T, DecodeError>where
T: Decode<Self>,
fn decode_prefix_with_constraint<T>(
&mut self,
constraint: T::Constraint,
) -> Result<T, DecodeError>where
T: Decode<Self>,
Decodes an owned value from the decoder with some constraint without finishing it.
On success, returns Ok of an owned value. Returns Err if decoding
failed.
Sourcefn decode<T>(&mut self) -> Result<T, DecodeError>
fn decode<T>(&mut self) -> Result<T, DecodeError>
Decodes an owned value from the decoder and finishes it.
On success, returns Ok of an owned value. Returns Err if decoding
failed.
Sourcefn decode_with_constraint<T>(
&mut self,
constraint: T::Constraint,
) -> Result<T, DecodeError>where
T: Decode<Self>,
fn decode_with_constraint<T>(
&mut self,
constraint: T::Constraint,
) -> Result<T, DecodeError>where
T: Decode<Self>,
Decodes an owned value from the decoder with some constraint and finishes it.
On success, returns Ok of an owned value. Returns Err if decoding
failed.
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.