Trait Decoder

pub unsafe trait Decoder: InternalHandleDecoder {
    // Required methods
    fn take_chunks_raw(
        &mut self,
        count: usize,
    ) -> Result<NonNull<WireU64>, DecodeError>;
    fn commit(&mut self);
    fn finish(&self) -> Result<(), DecodeError>;
}
Expand description

A decoder for FIDL messages.

§Safety

Pointers returned from take_chunks must:

  • Point to count initialized Chunks
  • Be valid for reads and writes
  • Remain valid until the decoder is dropped

The decoder may be moved without invalidating the returned pointers.

Required Methods§

fn take_chunks_raw( &mut self, count: usize, ) -> Result<NonNull<WireU64>, DecodeError>

Takes a slice of Chunks from the decoder, returning a pointer to them.

Returns Err if the decoder doesn’t have enough chunks left.

fn commit(&mut self)

Commits to any decoding operations which are in progress.

Resources like handles may be taken from a decoder during decoding. However, decoding may fail after those resources are taken but before decoding completes. To ensure that resources are always dropped, taken resources are still considered owned by the decoder until commit is called. After commit, ownership of those resources is transferred to the decoded data.

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

Verifies that decoding finished cleanly, with no leftover chunks or resources.

Implementations on Foreign Types§

§

impl Decoder for &mut [WireU64]

§

fn take_chunks_raw( &mut self, count: usize, ) -> Result<NonNull<WireU64>, DecodeError>

§

fn commit(&mut self)

§

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

§

impl Decoder for RecvBuffer

§

fn take_chunks_raw( &mut self, count: usize, ) -> Result<NonNull<WireU64>, DecodeError>

§

fn commit(&mut self)

§

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

Implementors§

§

impl Decoder for fidl_next::fuchsia::channel::RecvBuffer