pub trait DecoderExt<'buf> {
// Required methods
fn take_slot<T>(&mut self) -> Result<Slot<'buf, T>, DecodeError>;
fn take_slice_slot<T>(
&mut self,
len: usize,
) -> Result<Slot<'buf, [T]>, DecodeError>;
fn decode_next<T: Decode<Self>>(
&mut self,
) -> Result<Owned<'buf, T>, DecodeError>;
fn decode_next_slice<T: Decode<Self>>(
&mut self,
len: usize,
) -> Result<Owned<'buf, [T]>, DecodeError>;
fn decode_last<T: Decode<Self>>(
&mut self,
) -> Result<Owned<'buf, T>, DecodeError>;
fn decode_last_slice<T: Decode<Self>>(
&mut self,
len: usize,
) -> Result<Owned<'buf, [T]>, DecodeError>;
}
Expand description
Extension methods for Decoder
.
Required Methods§
Sourcefn take_slot<T>(&mut self) -> Result<Slot<'buf, T>, DecodeError>
fn take_slot<T>(&mut self) -> Result<Slot<'buf, 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<'buf, [T]>, DecodeError>
fn take_slice_slot<T>( &mut self, len: usize, ) -> Result<Slot<'buf, [T]>, DecodeError>
Takes enough chunks for a slice of T
, returning a Slot
of the taken slice.
Sourcefn decode_next<T: Decode<Self>>(
&mut self,
) -> Result<Owned<'buf, T>, DecodeError>
fn decode_next<T: Decode<Self>>( &mut self, ) -> Result<Owned<'buf, T>, DecodeError>
Decodes a T
and returns an Owned
pointer to it.
Returns Err
if decoding failed.
Sourcefn decode_next_slice<T: Decode<Self>>(
&mut self,
len: usize,
) -> Result<Owned<'buf, [T]>, DecodeError>
fn decode_next_slice<T: Decode<Self>>( &mut self, len: usize, ) -> Result<Owned<'buf, [T]>, DecodeError>
Decodes a slice of T
and returns an Owned
pointer to it.
Returns Err
if decoding failed.
Sourcefn decode_last<T: Decode<Self>>(
&mut self,
) -> Result<Owned<'buf, T>, DecodeError>
fn decode_last<T: Decode<Self>>( &mut self, ) -> Result<Owned<'buf, T>, DecodeError>
Finishes the decoder by decoding a T
.
On success, returns Ok
of an Owned
pointer to the decoded value. Returns Err
if the
decoder did not finish successfully.
Sourcefn decode_last_slice<T: Decode<Self>>(
&mut self,
len: usize,
) -> Result<Owned<'buf, [T]>, DecodeError>
fn decode_last_slice<T: Decode<Self>>( &mut self, len: usize, ) -> Result<Owned<'buf, [T]>, DecodeError>
Finishes the decoder by decoding a slice of T
.
On success, returns Ok
of an Owned
pointer to the decoded slice. Returns Err
if the
decoder did not finish successfully.
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.