pub trait Backend: DisplayBackend {
// Required methods
fn enable_raw_mode(&mut self) -> Result<()>;
fn disable_raw_mode(&mut self) -> Result<()>;
fn hide_cursor(&mut self) -> Result<()>;
fn show_cursor(&mut self) -> Result<()>;
fn get_cursor_pos(&mut self) -> Result<(u16, u16)>;
fn move_cursor_to(&mut self, x: u16, y: u16) -> Result<()>;
fn scroll(&mut self, dist: i16) -> Result<()>;
fn clear(&mut self, clear_type: ClearType) -> Result<()>;
fn size(&self) -> Result<Size>;
// Provided method
fn move_cursor(&mut self, direction: MoveDirection) -> Result<()> { ... }
}Expand description
A trait to represent a terminal that can be rendered to in an interactive manner.
Required Methods§
Sourcefn enable_raw_mode(&mut self) -> Result<()>
fn enable_raw_mode(&mut self) -> Result<()>
Enables raw mode.
Sourcefn disable_raw_mode(&mut self) -> Result<()>
fn disable_raw_mode(&mut self) -> Result<()>
Disables raw mode.
Sourcefn hide_cursor(&mut self) -> Result<()>
fn hide_cursor(&mut self) -> Result<()>
Hides the cursor.
Sourcefn show_cursor(&mut self) -> Result<()>
fn show_cursor(&mut self) -> Result<()>
Shows the cursor.
Sourcefn get_cursor_pos(&mut self) -> Result<(u16, u16)>
fn get_cursor_pos(&mut self) -> Result<(u16, u16)>
Gets the cursor position as (col, row). The top-left cell is (0, 0).
Sourcefn move_cursor_to(&mut self, x: u16, y: u16) -> Result<()>
fn move_cursor_to(&mut self, x: u16, y: u16) -> Result<()>
Moves the cursor to given position. The top-left cell is (0, 0).
Provided Methods§
Sourcefn move_cursor(&mut self, direction: MoveDirection) -> Result<()>
fn move_cursor(&mut self, direction: MoveDirection) -> Result<()>
Moves the cursor relative to the current position as per the direction.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<B: Backend> Backend for &mut B
impl<B: Backend> Backend for &mut B
fn enable_raw_mode(&mut self) -> Result<()>
fn disable_raw_mode(&mut self) -> Result<()>
fn hide_cursor(&mut self) -> Result<()>
fn show_cursor(&mut self) -> Result<()>
fn get_cursor_pos(&mut self) -> Result<(u16, u16)>
fn move_cursor_to(&mut self, x: u16, y: u16) -> Result<()>
fn move_cursor(&mut self, direction: MoveDirection) -> Result<()>
fn scroll(&mut self, dist: i16) -> Result<()>
fn clear(&mut self, clear_type: ClearType) -> Result<()>
fn size(&self) -> Result<Size>
Implementors§
impl Backend for TestBackend
impl<W: Write + AsFd> Backend for TermionBackend<W>
Available on crate feature
termion only.impl<W: Write> Backend for CrosstermBackend<W>
Available on crate feature
crossterm only.