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.

Object Safety§

This trait is not object safe.

Implementors§