fidl_next::encoder

Trait Encoder

Source
pub trait Encoder {
    // Required methods
    fn bytes_written(&self) -> usize;
    fn reserve(&mut self, len: usize);
    fn write(&mut self, bytes: &[u8]);
    fn rewrite(&mut self, pos: usize, bytes: &[u8]);
}
Expand description

An encoder for FIDL messages.

Required Methods§

Source

fn bytes_written(&self) -> usize

Returns the number of bytes written to the encoder.

Source

fn reserve(&mut self, len: usize)

Writes zeroed bytes to the end of the encoder.

Additional bytes are written to pad the written data to a multiple of CHUNK_SIZE.

Source

fn write(&mut self, bytes: &[u8])

Copies bytes to the end of the encoder.

Additional bytes are written to pad the written data to a multiple of CHUNK_SIZE.

Source

fn rewrite(&mut self, pos: usize, bytes: &[u8])

Rewrites bytes at a position in the encoder.

Implementations on Foreign Types§

Source§

impl Encoder for Vec<Chunk>

Source§

fn bytes_written(&self) -> usize

Source§

fn reserve(&mut self, len: usize)

Source§

fn write(&mut self, bytes: &[u8])

Source§

fn rewrite(&mut self, pos: usize, bytes: &[u8])

Source§

impl<T: Encoder> Encoder for &mut T

Source§

fn bytes_written(&self) -> usize

Source§

fn reserve(&mut self, len: usize)

Source§

fn write(&mut self, bytes: &[u8])

Source§

fn rewrite(&mut self, pos: usize, bytes: &[u8])

Implementors§