fidl_next::decoder

Trait DecoderExt

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

Source

fn take_slot<T>(&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<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.

Source

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.

Source

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.

Source

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.

Source

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.

Implementors§

Source§

impl<'buf, D: Decoder<'buf> + ?Sized> DecoderExt<'buf> for D