Trait MessageWriter

Source
pub trait MessageWriter {
    // Required methods
    fn new() -> Self;
    fn write(&mut self, data: &[u8]) -> Result<()>;
    fn remaining(&self) -> usize;
    fn finalize(self) -> Result<()>;
}
Expand description

A trait used by tokenize_to_writer! to output tokenized messages.

For more details on how this type is used, see the tokenize_to_writer! documentation.

Required Methods§

Source

fn new() -> Self

Returns a new instance of a MessageWriter.

Source

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

Append data to the message.

Source

fn remaining(&self) -> usize

Return the remaining space in this message instance.

If there are no space constraints, return usize::MAX.

Source

fn finalize(self) -> Result<()>

Finalize message.

finalize() is called when the tokenized message is complete.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§