pub trait ConsoleDevice: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn dimensions(&self) -> (usize, usize);
fn clear(&mut self) -> Result<(), KernelError>;
fn write_char(
&mut self,
x: usize,
y: usize,
ch: ConsoleChar,
) -> Result<(), KernelError>;
fn write_string(
&mut self,
x: usize,
y: usize,
s: &str,
color: u8,
) -> Result<(), KernelError>;
fn scroll_up(&mut self) -> Result<(), KernelError>;
fn set_cursor(&mut self, x: usize, y: usize) -> Result<(), KernelError>;
fn get_cursor(&self) -> (usize, usize);
fn set_cursor_visible(&mut self, visible: bool) -> Result<(), KernelError>;
}Expand description
Console device trait
Required Methods§
Sourcefn dimensions(&self) -> (usize, usize)
fn dimensions(&self) -> (usize, usize)
Get console dimensions
Sourcefn clear(&mut self) -> Result<(), KernelError>
fn clear(&mut self) -> Result<(), KernelError>
Clear the screen
Sourcefn write_char(
&mut self,
x: usize,
y: usize,
ch: ConsoleChar,
) -> Result<(), KernelError>
fn write_char( &mut self, x: usize, y: usize, ch: ConsoleChar, ) -> Result<(), KernelError>
Write a character at position
Sourcefn write_string(
&mut self,
x: usize,
y: usize,
s: &str,
color: u8,
) -> Result<(), KernelError>
fn write_string( &mut self, x: usize, y: usize, s: &str, color: u8, ) -> Result<(), KernelError>
Write a string at position
Sourcefn scroll_up(&mut self) -> Result<(), KernelError>
fn scroll_up(&mut self) -> Result<(), KernelError>
Scroll up by one line
Sourcefn set_cursor(&mut self, x: usize, y: usize) -> Result<(), KernelError>
fn set_cursor(&mut self, x: usize, y: usize) -> Result<(), KernelError>
Set cursor position
Sourcefn get_cursor(&self) -> (usize, usize)
fn get_cursor(&self) -> (usize, usize)
Get cursor position
Sourcefn set_cursor_visible(&mut self, visible: bool) -> Result<(), KernelError>
fn set_cursor_visible(&mut self, visible: bool) -> Result<(), KernelError>
Show/hide cursor