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§
Sourcefn get_separator(&self) -> &str
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.
Sourcefn format_byte(&self, byte: &u8) -> String
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§
Sourcefn format_buffer(&self, buffer: &[u8]) -> String
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>
impl BufferFormatter for Box<dyn BufferFormatter>
Source§fn get_separator(&self) -> &str
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.