ants/examples/print.rs

20 lines
362 B
Rust
Raw Normal View History

use ants::{
event::{Event, Events, Key, Mod},
raw_mode,
2023-03-19 00:10:08 +01:00
};
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;
2023-03-19 00:10:08 +01:00
}
}
}
raw_mode::exit().unwrap();
}