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>

source

pub fn new( screen_size: Option<ScreenSize>, output_stream: Output ) -> TtyBackend<Output>

Trait Implementations§

source§

impl<Output: Write> TerminalBackend for TtyBackend<Output>

§

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

Returns the screen size of the terminal.
source§

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>

Displays the given range of Units in the scrollback buffer by writing them to this terminal’s backend. Read more
source§

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

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 more
source§

fn set_insert_mode(&mut self, mode: InsertMode)

TODO: change this to support any arbitrary terminal mode
source§

fn reset_screen(&mut self)

Fully reset the terminal screen to its initial default state.
source§

fn clear_screen(&mut self)

Clears the entire terminal screen.
source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.