ptah

Trait Writer

Source
pub trait Writer {
    // Required methods
    fn write(&mut self, buf: &[u8]) -> Result<()>;
    fn push_handle(&mut self, handle: Handle) -> Result<HandleSlot>;
    fn bytes_written(&self) -> usize;
}
Expand description

A Writer represents a consumer of the bytes produced by serializing a message. In cases where you can create a slice to put the bytes in, CursorWriter can be used. Custom Writers are useful for more niche uses, such as sending the serialized bytes over a serial port.

Required Methods§

Source

fn write(&mut self, buf: &[u8]) -> Result<()>

Source

fn push_handle(&mut self, handle: Handle) -> Result<HandleSlot>

Source

fn bytes_written(&self) -> usize

Implementations on Foreign Types§

Source§

impl<'a> Writer for &'a mut Vec<u8>

Source§

fn write(&mut self, buf: &[u8]) -> Result<()>

Source§

fn push_handle(&mut self, _handle: Handle) -> Result<HandleSlot>

Source§

fn bytes_written(&self) -> usize

Implementors§

Source§

impl<'a> Writer for CursorWriter<'a>