Trait DecoderExt

Source
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§

Source

fn take_chunks<'buf>( self: &mut &'buf mut Self, count: usize, ) -> Result<&'buf mut [Chunk], DecodeError>

Takes a slice of Chunks from the decoder.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Implementors§

Source§

impl<D: Decoder + ?Sized> DecoderExt for D