pub trait CharDevice: Device {
// Required methods
fn read_byte(&mut self) -> Option<u8>;
fn write_byte(&mut self, byte: u8) -> Result<(), &'static str>;
fn can_read(&self) -> bool;
fn can_write(&self) -> bool;
// Provided methods
fn read(&mut self, buffer: &mut [u8]) -> usize { ... }
fn write(&mut self, buffer: &[u8]) -> Result<usize, &'static str> { ... }
}
Expand description
Character device interface
This trait defines the interface for character devices. It provides methods for querying device information and handling character I/O operations.
Required Methods§
Sourcefn read_byte(&mut self) -> Option<u8>
fn read_byte(&mut self) -> Option<u8>
Read a single byte from the device
§Returns
The byte read from the device, or None if no data is available