getch/
getch.rs

1extern crate getch_rs;
2use getch_rs::{Getch, Key};
3
4fn main() {
5    let g = Getch::new();
6
7    println!("press `q` to exit");
8
9    loop {
10        match g.getch() {
11            Ok(Key::Char('q')) => break,
12            Ok(key) => println!("{:?}", key),
13            Err(e) => println!("{}", e),
14        }
15    }
16}