pub trait TerminalWriter<Term: Terminal> {
    fn size(&self) -> Result<Size>;
    fn clear_screen(&mut self) -> Result<()>;
    fn clear_to_screen_end(&mut self) -> Result<()>;
    fn move_up(&mut self, n: usize) -> Result<()>;
    fn move_down(&mut self, n: usize) -> Result<()>;
    fn move_left(&mut self, n: usize) -> Result<()>;
    fn move_right(&mut self, n: usize) -> Result<()>;
    fn move_to_first_column(&mut self) -> Result<()>;
    fn set_cursor_mode(&mut self, mode: CursorMode) -> Result<()>;
    fn write(&mut self, s: &str) -> Result<()>;
    fn flush(&mut self) -> Result<()>;
}
Expand description

Holds a lock on Terminal write operations

Required Methods

Returns the size of the terminal window

Presents a clear terminal screen, with cursor at first row, first column.

If the terminal possesses a scrolling window over a buffer, this shall have the effect of moving the visible window down such that it shows an empty view of the buffer, preserving some or all of existing buffer contents, where possible.

Clears characters on the line occupied by the cursor, beginning with the cursor and ending at the end of the line. Also clears all characters on all lines after the cursor.

Moves the cursor up n cells; n may be zero.

Moves the cursor down n cells; n may be zero.

Moves the cursor left n cells; n may be zero.

Moves the cursor right n cells; n may be zero.

Moves the cursor to the first column of the current line

Set the current cursor mode

Writes output to the terminal.

For each carriage return '\r' written to the terminal, the cursor should be moved to the first column of the current line.

For each newline '\n' written to the terminal, the cursor should be moved to the first column of the following line.

The terminal interface shall not automatically move the cursor to the next line when write causes a character to be written to the final column.

Flushes any currently buffered output data.

TerminalWriter instances may not buffer data on all systems.

Data must be flushed when the TerminalWriter instance is dropped.

Implementations on Foreign Types

Implementors