[−][src]Crate crossterm_terminal
Terminal
The crossterm_terminal
crate is deprecated and no longer maintained. The GitHub repository will
be archived soon. All the code is being moved to the crossterm
crate. You can learn more in
the Merge sub-crates to the crossterm crate
issue.
The crossterm_terminal
crate provides a functionality to work with the terminal.
This documentation does not contain a lot of examples. The reason is that it's fairly obvious how to use this crate. Although, we do provide examples repository to demonstrate the capabilities.
Examples
use crossterm_terminal::{Result, Terminal}; fn main() -> Result<()> { // Get a terminal, save size let terminal = Terminal::new(); let (cols, rows) = terminal.size()?; // Do something with the terminal terminal.set_size(10, 10)?; terminal.scroll_up(5)?; // Be a good citizen, cleanup terminal.set_size(cols, rows) }
Commands:
use std::io::{stdout, Write}; use crossterm_terminal::{execute, Result, ScrollUp, SetSize, Terminal}; fn main() -> Result<()> { // Get a terminal, save size let terminal = Terminal::new(); let (cols, rows) = terminal.size()?; // Do something with the terminal execute!( stdout(), SetSize(10, 10), ScrollUp(5) )?; // Be a good citizen, cleanup terminal.set_size(cols, rows) }
Re-exports
pub use crossterm_utils::execute; |
pub use crossterm_utils::queue; |
pub use crossterm_utils::Command; |
pub use crossterm_utils::ExecutableCommand; |
pub use crossterm_utils::QueueableCommand; |
pub use crossterm_utils::Result; |
Structs
Clear | A command to clear the terminal. |
ScrollDown | A command to scroll the terminal given rows down. |
ScrollUp | A command to scroll the terminal given rows up. |
SetSize | A command to set the terminal size (rows, columns). |
Terminal | A terminal. |
Enums
ClearType | Represents different options how to clear the terminal. |
Functions
terminal | Creates a new |