Skip to main content

ProcessTerminal

Struct ProcessTerminal 

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

Process-based terminal using crossterm.

Implementations§

Source§

impl ProcessTerminal

Source

pub fn new() -> Self

Create a new process terminal.

Trait Implementations§

Source§

impl Default for ProcessTerminal

Source§

fn default() -> Self

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

impl Terminal for ProcessTerminal

Source§

fn info(&self) -> TerminalInfo

Get terminal information (columns, rows, capabilities).
Source§

fn write(&self, data: &str)

Write raw bytes to the terminal.
Source§

fn hide_cursor(&self)

Hide the cursor.
Source§

fn show_cursor(&self)

Show the cursor.
Source§

fn move_cursor(&self, row: usize, col: usize)

Move cursor to position (0-indexed).
Source§

fn clear_screen(&self)

Clear the screen.
Source§

fn set_title(&self, title: &str)

Set terminal title.
Source§

fn enable_mouse(&self)

Enable mouse events.
Source§

fn disable_mouse(&self)

Disable mouse events.
Source§

fn enter_raw_mode(&self)

Enter terminal raw mode (required for event::read() to deliver individual key events without line buffering). Pairs with Terminal::stop, which exits raw mode. Read more
Source§

fn exit_raw_mode(&self)

Leave raw mode without stopping the terminal, so the shell gets a working line discipline back. Pairs with Terminal::enter_raw_mode; a Ctrl+Z suspend uses it, then re-enters raw mode on resume.
Source§

fn refresh_size(&self)

Re-read the current terminal size into the cached TerminalInfo. Called on Event::Resize so subsequent renders use the new dimensions.
Source§

fn start( &self, on_input: Box<dyn Fn(InputEvent) + Send + Sync>, on_resize: Box<dyn Fn() + Send + Sync>, )

Start terminal raw mode.
Source§

fn stop(&self)

Stop terminal and restore original state.
Source§

fn is_tty(&self) -> bool

Check if terminal is a TTY.
Source§

fn set_progress(&self, active: bool)

Set progress indicator (terminal progress bar support).
Source§

fn flush(&self)

Flush output buffer.
Source§

fn columns(&self) -> usize

Get current terminal width in columns.
Source§

fn rows(&self) -> usize

Get current terminal height in rows.

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.