Struct fidl_next::decoder::BasicDecoder

source ·
pub struct BasicDecoder<'buf> { /* private fields */ }
Expand description

A basic decoder.

Basic decoders do not support resources.

Implementations§

source§

impl<'buf> BasicDecoder<'buf>

source

pub fn new(chunks: &'buf mut [Chunk]) -> Self

Returns a new decoder for the given chunks and handles.

source

pub fn finish(self) -> Result<(), DecodeError>

Finishes decoding.

Returns Err if not all chunks or handles were used.

source

pub fn decode<T: Decode<Self>>(self) -> Result<Owned<'buf, T>, DecodeError>

Decodes the entirety of the decoder’s data as a T.

Returns Err if decoding failed or not all chunks or handles were used.

Trait Implementations§

source§

impl<'buf> Decoder<'buf> for BasicDecoder<'buf>

source§

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

Takes a slice of Chunks from the decoder. Read more

Auto Trait Implementations§

§

impl<'buf> Freeze for BasicDecoder<'buf>

§

impl<'buf> RefUnwindSafe for BasicDecoder<'buf>

§

impl<'buf> Send for BasicDecoder<'buf>

§

impl<'buf> Sync for BasicDecoder<'buf>

§

impl<'buf> Unpin for BasicDecoder<'buf>

§

impl<'buf> !UnwindSafe for BasicDecoder<'buf>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

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

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>(&mut self) -> Result<Owned<'buf, T>, DecodeError>
where T: Decode<D>,

Decodes a T and returns an Owned pointer to it. Read more
source§

fn decode_next_slice<T>( &mut self, len: usize, ) -> Result<Owned<'buf, [T]>, DecodeError>
where T: Decode<D>,

Decodes a slice of T and returns an Owned pointer to it. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.