pub trait DebugWriter {
// Required methods
fn write(&self, bytes: &[u8], overflow_message: &[u8]) -> usize;
fn available_len(&self) -> usize;
fn to_write_len(&self) -> usize;
fn publish(&self) -> usize;
fn flush(&self, writer: &mut dyn IoWrite);
}Expand description
A trait for writing debug output.
This can be used for example to implement asynchronous or synchronous writers, and buffered or unbuffered writers. Various platforms may have in-memory logs, memory mapped “endless” FIFOs, JTAG support for output, etc.
Required Methods§
Sourcefn write(&self, bytes: &[u8], overflow_message: &[u8]) -> usize
fn write(&self, bytes: &[u8], overflow_message: &[u8]) -> usize
Write bytes to output with overflow notification.
The overflow slice is used as a message to be appended to the end of
the available buffer if it becomes full.
Sourcefn available_len(&self) -> usize
fn available_len(&self) -> usize
Available length of the internal buffer if limited.
If the buffer can support a write of any size, it should lie and return
usize::MAX.
Across subsequent calls to this function, without invoking write() in
between, this returned value may only increase, but never decrease.
Sourcefn to_write_len(&self) -> usize
fn to_write_len(&self) -> usize
How many bytes are buffered and not yet written.