pub trait DecoderExt {
// Required methods
fn take_chunks<'buf>(
self: &mut &'buf mut Self,
count: usize,
) -> Result<&'buf mut [Chunk], DecodeError>;
fn take_slot<'buf, T>(
self: &mut &'buf mut Self,
) -> Result<Slot<'buf, T>, DecodeError>;
fn take_slice_slot<'buf, T>(
self: &mut &'buf mut Self,
len: usize,
) -> Result<Slot<'buf, [T]>, DecodeError>;
fn decode_next<'buf, T: Decode<Self>>(
self: &mut &'buf mut Self,
) -> Result<Owned<'buf, T>, DecodeError>;
fn decode_next_slice<'buf, T: Decode<Self>>(
self: &mut &'buf mut Self,
len: usize,
) -> Result<Owned<'buf, [T]>, DecodeError>;
fn decode_last<'buf, T: Decode<Self>>(
self: &mut &'buf mut Self,
) -> Result<Owned<'buf, T>, DecodeError>;
fn decode_last_slice<'buf, T: Decode<Self>>(
self: &mut &'buf mut Self,
len: usize,
) -> Result<Owned<'buf, [T]>, DecodeError>;
}
Expand description
Extension methods for Decoder
.
Required Methods§
Sourcefn take_chunks<'buf>(
self: &mut &'buf mut Self,
count: usize,
) -> Result<&'buf mut [Chunk], DecodeError>
fn take_chunks<'buf>( self: &mut &'buf mut Self, count: usize, ) -> Result<&'buf mut [Chunk], DecodeError>
Takes a slice of Chunk
s from the decoder.
Sourcefn take_slot<'buf, T>(
self: &mut &'buf mut Self,
) -> Result<Slot<'buf, T>, DecodeError>
fn take_slot<'buf, T>( self: &mut &'buf mut Self, ) -> Result<Slot<'buf, T>, DecodeError>
Takes enough chunks for a T
, returning a Slot
of the taken value.
Sourcefn take_slice_slot<'buf, T>(
self: &mut &'buf mut Self,
len: usize,
) -> Result<Slot<'buf, [T]>, DecodeError>
fn take_slice_slot<'buf, T>( self: &mut &'buf 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<'buf, T: Decode<Self>>(
self: &mut &'buf mut Self,
) -> Result<Owned<'buf, T>, DecodeError>
fn decode_next<'buf, T: Decode<Self>>( self: &mut &'buf 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<'buf, T: Decode<Self>>(
self: &mut &'buf mut Self,
len: usize,
) -> Result<Owned<'buf, [T]>, DecodeError>
fn decode_next_slice<'buf, T: Decode<Self>>( self: &mut &'buf 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<'buf, T: Decode<Self>>(
self: &mut &'buf mut Self,
) -> Result<Owned<'buf, T>, DecodeError>
fn decode_last<'buf, T: Decode<Self>>( self: &mut &'buf 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<'buf, T: Decode<Self>>(
self: &mut &'buf mut Self,
len: usize,
) -> Result<Owned<'buf, [T]>, DecodeError>
fn decode_last_slice<'buf, T: Decode<Self>>( self: &mut &'buf 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.