pub struct Terminal { /* private fields */ }
Expand description
A terminal.
The Terminal
instance is stateless and does not hold any data.
You can create as many instances as you want and they will always refer to the
same terminal.
§Examples
Basic usage:
use crossterm_terminal::{Result, Terminal};
fn main() -> Result<()> {
let terminal = Terminal::new();
let (cols, rows) = terminal.size()?;
terminal.set_size(10, 10)?;
terminal.scroll_up(5)?;
terminal.set_size(cols, rows)
}
Implementations§
Source§impl Terminal
impl Terminal
Sourcepub fn clear(&self, clear_type: ClearType) -> Result<()>
pub fn clear(&self, clear_type: ClearType) -> Result<()>
Clears the terminal.
See the ClearType
enum to learn about
all ways how the terminal can be cleared.
Sourcepub fn scroll_down(&self, row_count: u16) -> Result<()>
pub fn scroll_down(&self, row_count: u16) -> Result<()>
Scrolls the terminal row_count
rows down.
Sourcepub fn exit(&self)
pub fn exit(&self)
Exits the current process.
§Platform-specific Behavior
std::process::exit
is
called internally with platform specific exit codes.
Unix: exit code 0.
Windows: exit code 256.
Auto Trait Implementations§
impl Freeze for Terminal
impl RefUnwindSafe for Terminal
impl Send for Terminal
impl Sync for Terminal
impl Unpin for Terminal
impl UnwindSafe for Terminal
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