Struct text_terminal::TtyBackend
source · pub struct TtyBackend<Output: Write> { /* private fields */ }
Expand description
A terminal backend that is simply a character device TTY endpoint (a full terminal emulator) on the other side, which only allows writing a stream of bytes to it.
A TTY backend doesn’t support any form of random access or direct text rendering, so we can only issue regular ANSI/xterm control and escape sequences to it.
Implementations§
source§impl<Output: Write> TtyBackend<Output>
impl<Output: Write> TtyBackend<Output>
pub fn new( screen_size: Option<ScreenSize>, output_stream: Output ) -> TtyBackend<Output>
Trait Implementations§
source§impl<Output: Write> TerminalBackend for TtyBackend<Output>
impl<Output: Write> TerminalBackend for TtyBackend<Output>
§type DisplayError = Error
type DisplayError = Error
The Error type returned by the
TerminalBackend::display()
function
if it returns a Result::Err
variant.source§fn screen_size(&self) -> ScreenSize
fn screen_size(&self) -> ScreenSize
Returns the screen size of the terminal.
source§fn update_screen_size(&mut self, new_size: ScreenSize)
fn update_screen_size(&mut self, new_size: ScreenSize)
Resizes the terminal screen.
TODO: perform a full reflow of the contents currently displayed on screen.
source§fn display(
&mut self,
display_action: DisplayAction,
scrollback_buffer: &ScrollbackBuffer,
previous_style: Option<Style>
) -> Result<ScreenPoint, Self::DisplayError>
fn display( &mut self, display_action: DisplayAction, scrollback_buffer: &ScrollbackBuffer, previous_style: Option<Style> ) -> Result<ScreenPoint, Self::DisplayError>
Displays the given range of
Unit
s in the scrollback buffer
by writing them to this terminal’s backend. Read moresource§fn move_cursor_to(&mut self, new_position: ScreenPoint) -> ScreenPoint
fn move_cursor_to(&mut self, new_position: ScreenPoint) -> ScreenPoint
Moves the on-screen cursor to the given position. Read more
source§fn move_cursor_by(&mut self, num_cols: i32, num_rows: i32) -> ScreenPoint
fn move_cursor_by(&mut self, num_cols: i32, num_rows: i32) -> ScreenPoint
Moves the on-screen cursor by the given number of rows and columns,
in which a value of
0
indicates no movement in that dimension. Read moresource§fn set_insert_mode(&mut self, mode: InsertMode)
fn set_insert_mode(&mut self, mode: InsertMode)
TODO: change this to support any arbitrary terminal mode
source§fn reset_screen(&mut self)
fn reset_screen(&mut self)
Fully reset the terminal screen to its initial default state.
source§fn clear_screen(&mut self)
fn clear_screen(&mut self)
Clears the entire terminal screen.
source§fn write_bytes(&mut self, bytes: &[u8])
fn write_bytes(&mut self, bytes: &[u8])
A temporary hack to allow direct writing to the backend’s output stream.
This is only relevant for TtyBackends.
Auto Trait Implementations§
impl<Output> RefUnwindSafe for TtyBackend<Output>where Output: RefUnwindSafe,
impl<Output> Send for TtyBackend<Output>where Output: Send,
impl<Output> Sync for TtyBackend<Output>where Output: Sync,
impl<Output> Unpin for TtyBackend<Output>where Output: Unpin,
impl<Output> UnwindSafe for TtyBackend<Output>where Output: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more