Crate terminal_trx
source ·Expand description
Provides a handle to the terminal of the current process that is both readable and writable.
§Example: Read and Write
use terminal_trx::terminal;
use std::io::{BufReader, BufRead as _, Write as _};
let mut terminal = terminal().unwrap();
write!(terminal, "hello world").unwrap();
let mut reader = BufReader::new(&mut terminal);
let mut line = String::new();
reader.read_line(&mut line).unwrap();
§Example: Enable Raw Mode
use terminal_trx::terminal;
let mut tty = terminal().unwrap();
let mut lock = tty.lock();
let mut raw_mode = lock.enable_raw_mode().unwrap();
// You can now perform read and write operations using `raw_mode`.
Structs§
- Guard for raw mode on the terminal, disables raw mode on drop. Can be crated using
TerminalLock::enable_raw_mode
. - A readable and writable handle to the terminal (or TTY), created using
terminal()
. You can read and write data using theio::Read
andio::Write
implementations respectively. - Guard for exclusive read- and write access to the terminal. Can be created using
Terminal::lock
.
Traits§
Functions§
- Creates a readable and writable handle to the terminal (or TTY) if available.