[][src]Trait rust_lcm_codec::StreamingWriter

pub trait StreamingWriter {
    type Error;
    fn write_bytes(&mut self, bytes: &[u8]) -> Result<(), Self::Error>;
fn share_bytes_mut(
        &mut self,
        len: usize
    ) -> Result<&mut [MaybeUninit<u8>], Self::Error>;
fn flush() -> Result<(), Self::Error>; }

Writer backend trait

Associated Types

type Error

The kind of errors that the implementation emits during encoding

Loading content...

Required methods

fn write_bytes(&mut self, bytes: &[u8]) -> Result<(), Self::Error>

Write all of the bytes from the provided buffer into the underlying encoding stream.

Ought to produce an error if not all of the bytes could be written.

N.B. for possible enhancement: We could return size written here rather than leaving that tracking and manner of exposure to the implementing type.

fn share_bytes_mut(
    &mut self,
    len: usize
) -> Result<&mut [MaybeUninit<u8>], Self::Error>

Expose an aliased view of a subset of the underlying data as mutable bytes.

The implementer must ensure that the view of bytes returned does not overlap with the region of bytes that the StreamingWriter allows itself to mutate at any further point.

fn flush() -> Result<(), Self::Error>

Ensure that all bytes are fully written in a maximally durable fashion.

Loading content...

Implementors

impl<'a> StreamingWriter for BufferWriter<'a>[src]

type Error = BufferWriterError

Loading content...