[][src]Function crossterm_input::input

pub fn input() -> TerminalInput

Creates a new TerminalInput.

Examples

// You can replace the following line with `use crossterm::...;`
// if you're using the `crossterm` crate with the `input` feature enabled.
use crossterm_input::{input, RawScreen, Result};

fn main() -> Result<()> {
    let input = input();
    // Read a single character
    let char = input.read_char()?;
    // Read a single line
    let line = input.read_line()?;

    // Make sure to enable raw screen when reading input events
    let screen = RawScreen::into_raw_mode();

    // Create async reader
    let mut async_stdin = input.read_async();

    // Create sync reader
    let mut sync_stdin = input.read_sync();

    // Enable mouse input events
    input.enable_mouse_mode()?;
    // Disable mouse input events
    input.disable_mouse_mode()
}