#[non_exhaustive]pub enum InputEvent {
Button {
code: ButtonCode,
pressed: bool,
},
Pointer {
x: i16,
y: i16,
},
PointerButton {
button: PointerButton,
pressed: bool,
},
Touch {
id: u8,
phase: TouchPhase,
x: i16,
y: i16,
},
Scroll {
axis: ScrollAxis,
delta: i16,
},
Key {
scancode: u16,
pressed: bool,
},
}Expand description
A semantic input event, independent of its hardware or OS source.
Positions are in logical UI coordinates — the same units an HMI app
renders at — so the source owns device-to-logical calibration and every
backend consumes one coordinate space. i16 is deliberate: it spans any
realistic panel while staying a fixed, IpcSafe width across cores
(unlike usize).
The enum is #[non_exhaustive]; match with a wildcard arm so new event
kinds can be added without a breaking change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Button
A digital button, D-pad direction, or key changed state.
Fields
code: ButtonCodeWhich logical control changed.
Pointer
Absolute pointer/cursor motion, in logical UI coordinates.
Fields
PointerButton
A pointer (mouse) button changed state at the last known position.
Touch
A single touch contact, in logical UI coordinates.
Fields
phase: TouchPhaseLifecycle phase of this contact.
Scroll
A scroll/wheel tick along one axis, in logical detents.
Fields
axis: ScrollAxisAxis the scroll applies to.
Key
A raw keyboard scancode, for text and navigation backends.
The scancode space is backend-defined (e.g. USB HID usage IDs); this crate does not enumerate keys, keeping the model small and stable.
Trait Implementations§
Source§impl Clone for InputEvent
impl Clone for InputEvent
Source§fn clone(&self) -> InputEvent
fn clone(&self) -> InputEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more