[−][src]Struct crossterm::terminal::Terminal
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::{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) }
Methods
impl Terminal
[src]
pub fn new() -> Terminal
[src]
Creates a new Terminal
.
pub fn clear(&self, clear_type: ClearType) -> Result<()>
[src]
Clears the terminal.
See the ClearType
enum to learn about
all ways how the terminal can be cleared.
pub fn size(&self) -> Result<(u16, u16)>
[src]
Returns the terminal size ((columns, rows)
).
pub fn scroll_up(&self, row_count: u16) -> Result<()>
[src]
Scrolls the terminal row_count
rows up.
pub fn scroll_down(&self, row_count: u16) -> Result<()>
[src]
Scrolls the terminal row_count
rows down.
pub fn set_size(&self, columns: u16, rows: u16) -> Result<()>
[src]
Sets the terminal size.
pub fn exit(&self)
[src]
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.
pub fn write<D: Display>(&self, value: D) -> Result<usize>
[src]
Writes any displayable content to the current terminal and flushes the standard output.
Auto Trait Implementations
impl Send for Terminal
impl Sync for Terminal
impl Unpin for Terminal
impl !UnwindSafe for Terminal
impl !RefUnwindSafe for Terminal
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,