Understand the Event and EventType structs
mainrdev distinguishes between physical key presses and interpreted characters:
EventType: Represents a physical event (e.g., a QWERTY layout key press). This is what you use for simulation.Event: Represents the actual event received from the OS. It includes theEventTypeand anEvent.namefield, which reflects the character interpreted by the OS based on the current keyboard layout.
Warning: Event.name can be None, an empty string, or contain non-displayable Unicode characters. Always perform sanity checks before using it.
EventType Variants
KeyPress(Key)KeyRelease(Key)ButtonPress(Button)ButtonRelease(Button)MouseMove { x: f64, y: f64 }Wheel { delta_x: i64, delta_y: i64 }(Note: On Linux,delta_xis ignored; only the sign ofdelta_yis used to determine direction.)