ableos/ableos/src/device_interface/character/mod.rs

23 lines
645 B
Rust
Raw Normal View History

2022-03-02 14:38:22 +00:00
//!
/// Character device interface.
pub trait CharacterDevice {
/// Returns true if the device can be read from.
fn can_read(&self) -> bool;
2022-04-11 22:23:11 +00:00
/// Returns true if the device can be written to
fn can_write(&self) -> bool;
2022-04-11 22:23:11 +00:00
/// Reads a single character from the device
fn read_char(&mut self) -> Option<char>;
2022-04-11 22:23:11 +00:00
/// Writes a single character to the device and returns true if the write was successful
fn write_char(&mut self, c: char) -> bool;
2022-04-11 22:23:11 +00:00
2022-03-02 14:38:22 +00:00
/// Reset the device to its initial state
fn reset(&mut self);
2022-04-11 22:23:11 +00:00
2022-03-02 14:38:22 +00:00
/// initializes the device, returns true if successful
fn initialize(&mut self) -> bool;
}