threaded/threaded.rs
1//! Prints the events of a connected SpaceMouse until Enter is pressed.
2//!
3//! Uses `SpaceMouseThread`, which scans for the device on a background thread
4//! and reconnects automatically.
5
6use spacemouse::SpaceMouseThread;
7use std::io;
8
9fn main() {
10 let _spacemouse = SpaceMouseThread::new(|event| println!("{event:?}"));
11 println!("Listening for SpaceMouse events. Press Enter to quit.");
12 let _ = io::stdin().read_line(&mut String::new());
13}