device_query_revamped 2.2.1

A basic library for querying keyboard and mouse state on-demand without a window.
Documentation
extern crate device_query;

use device_query::{DeviceEvents, DeviceState};
use std::thread;
use std::time::Duration;

fn main() {
    let device_state = DeviceState::new();
    let _guard = device_state.on_key_down(|key| {
        println!("Down: {:#?}", key);
    });
    let _guard = device_state.on_key_up(|key| {
        println!("Up: {:#?}", key);
    });

    loop {
        thread::sleep(Duration::from_secs(1000));
    }
}