Trait BufferFormatter

Source
pub trait BufferFormatter: Send + 'static {
    // Required methods
    fn get_separator(&self) -> &str;
    fn format_byte(&self, byte: &u8) -> String;

    // Provided method
    fn format_buffer(&self, buffer: &[u8]) -> String { ... }
}
Expand description

This trait allows to format bytes buffer using format_buffer method. It should be implemented for structures which are going to be used as formatting part inside LoggedStream.

Required Methods§

Source

fn get_separator(&self) -> &str

This method returns a separator which will be inserted between bytes during format_buffer method call. It should be implemented manually.

Source

fn format_byte(&self, byte: &u8) -> String

This method accepts one byte from buffer and format it into String. It should be implemeted manually.

Provided Methods§

Source

fn format_buffer(&self, buffer: &[u8]) -> String

This method accepts bytes buffer and format it into String. It is automatically implemented method.

Trait Implementations§

Source§

impl BufferFormatter for Box<dyn BufferFormatter>

Source§

fn get_separator(&self) -> &str

This method returns a separator which will be inserted between bytes during format_buffer method call. It should be implemented manually.
Source§

fn format_byte(&self, byte: &u8) -> String

This method accepts one byte from buffer and format it into String. It should be implemeted manually.
Source§

fn format_buffer(&self, buffer: &[u8]) -> String

This method accepts bytes buffer and format it into String. It is automatically implemented method.

Implementations on Foreign Types§

Source§

impl BufferFormatter for Box<BinaryFormatter>

Source§

fn get_separator(&self) -> &str

Source§

fn format_byte(&self, byte: &u8) -> String

Source§

impl BufferFormatter for Box<DecimalFormatter>

Source§

fn get_separator(&self) -> &str

Source§

fn format_byte(&self, byte: &u8) -> String

Source§

impl BufferFormatter for Box<LowercaseHexadecimalFormatter>

Source§

fn get_separator(&self) -> &str

Source§

fn format_byte(&self, byte: &u8) -> String

Source§

impl BufferFormatter for Box<OctalFormatter>

Source§

fn get_separator(&self) -> &str

Source§

fn format_byte(&self, byte: &u8) -> String

Source§

impl BufferFormatter for Box<UppercaseHexadecimalFormatter>

Source§

fn get_separator(&self) -> &str

Source§

fn format_byte(&self, byte: &u8) -> String

Source§

impl BufferFormatter for Box<dyn BufferFormatter>

Source§

fn get_separator(&self) -> &str

Source§

fn format_byte(&self, byte: &u8) -> String

Implementors§