Terminal

Struct Terminal 

Source
pub struct Terminal { /* private fields */ }
Expand description

Terminal handle for I/O operations.

Implementations§

Source§

impl Terminal

Source

pub fn new() -> Result<Self>

Create a new terminal handle.

Source

pub fn size(&self) -> (u16, u16)

Get terminal dimensions (columns, rows).

Source

pub fn refresh_size(&mut self) -> Result<()>

Refresh terminal size.

Source

pub fn write(&mut self, content: &str) -> Result<()>

Write content to the terminal.

Source

pub fn flush(&mut self) -> Result<()>

Flush the output buffer.

Source

pub fn clear(&mut self) -> Result<()>

Clear the entire screen.

Source

pub fn clear_from_cursor(&mut self) -> Result<()>

Clear from cursor to end of screen.

Source

pub fn clear_line(&mut self) -> Result<()>

Clear the current line.

Source

pub fn move_cursor(&mut self, x: u16, y: u16) -> Result<()>

Move cursor to position (1-indexed).

Source

pub fn hide_cursor(&mut self) -> Result<()>

Hide the cursor.

Source

pub fn show_cursor(&mut self) -> Result<()>

Show the cursor.

Source

pub fn save_cursor(&mut self) -> Result<()>

Save cursor position.

Source

pub fn restore_cursor(&mut self) -> Result<()>

Restore cursor position.

Source

pub fn enter_alternate_screen(&mut self) -> Result<()>

Enable alternate screen buffer.

Source

pub fn leave_alternate_screen(&mut self) -> Result<()>

Disable alternate screen buffer.

Source

pub fn enable_mouse(&mut self) -> Result<()>

Enable mouse capture.

Source

pub fn disable_mouse(&mut self) -> Result<()>

Disable mouse capture.

Source

pub fn enable_raw_mode(&self) -> Result<()>

Enable raw mode.

Source

pub fn disable_raw_mode(&self) -> Result<()>

Disable raw mode.

Source

pub fn is_raw_mode(&self) -> bool

Check if raw mode is enabled.

Source

pub fn read_event( &self, timeout: Option<Duration>, ) -> Result<Option<TerminalEvent>>

Read a single event with optional timeout.

Trait Implementations§

Source§

impl Default for Terminal

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for Terminal

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.