ants/examples/print.rs

19 lines
362 B
Rust

use ants::{
event::{Event, Events, Key, Mod},
raw_mode,
};
fn main() {
raw_mode::enter().unwrap();
print!("Press Ctrl+q to exit.\r\n");
let mut events = Events::new();
loop {
if let Some(event) = events.next() {
print!("{:?}\r\n", event);
if let Event::Key(Key::Char('q'), Mod::Ctrl) = event {
break;
}
}
}
raw_mode::exit().unwrap();
}