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§

Traits§

Functions§

  • Creates a readable and writable handle to the terminal (or TTY) if available.