Trait kernel::debug::IoWrite

source ·
pub trait IoWrite {
    // Required method
    fn write(&mut self, buf: &[u8]) -> usize;

    // Provided method
    fn write_ring_buffer(&mut self, buf: &RingBuffer<'_, u8>) -> usize { ... }
}
Expand description

This trait is similar to std::io::Write in that it takes bytes instead of a string (contrary to core::fmt::Write), but io::Write isn’t available in no_std (due to std::io::Error not being available).

Also, in our use cases, writes are infaillible, so the write function cannot return an Error, however it might not be able to write everything, so it returns the number of bytes written.

See also the tracking issue: https://github.com/rust-lang/rfcs/issues/2262

Required Methods§

source

fn write(&mut self, buf: &[u8]) -> usize

Provided Methods§

source

fn write_ring_buffer(&mut self, buf: &RingBuffer<'_, u8>) -> usize

Implementors§