pub enum InputEvent {
Key {
key: PhysicalKeyCode,
state: ButtonState,
},
PointerMoved {
sample: PointerSample,
},
RelativePointerMotion {
motion: RelativePointerMotion,
},
MouseWheel {
delta: ScrollDelta,
},
MouseButton {
button: MouseButton,
state: ButtonState,
},
PointerLeft,
FocusLost,
}Expand description
One platform-independent physical input event.
Repeated presses of an already-held key or mouse button, and repeated releases of one already up, do not create logical edges. Motion updates continuous state without creating edges. Event order determines the pointer sample captured by each mouse edge.
Variants§
Key
A physical keyboard state change.
Fields
key: PhysicalKeyCodeThe physical location of the key.
state: ButtonStateThe reported button state.
PointerMoved
Updates the continuous pointer without generating a logical action edge.
Fields
sample: PointerSampleFinite logical coordinates and the viewport at this point in event order.
RelativePointerMotion
Adds raw displacement to this frame’s relative motion without changing the absolute pointer or generating action edges. Not retained for fixed ticks. FocusLost clears motion and ignores later motion in the same batch.
Fields
motion: RelativePointerMotionValidated raw device displacement, independent of the viewport/DPI.
MouseWheel
One wheel occurrence with explicit line or logical-pixel units. Captures the latest pointer in event order; no binding, fixed replay, or token. FocusLost discards all wheel events in the same accepted batch.
Fields
delta: ScrollDeltaFinite per-event displacement; separate occurrences are not combined.
MouseButton
A physical mouse-button state change, using the latest pointer sample.
PointerLeft
Clears the pointer and releases held mouse buttons in Left/Right/Middle order. Synthesized releases have no pointer sample. Keyboard state is unchanged. The generated releases have a PointerLeft cancellation reason.
FocusLost
Clears the pointer and cancels held mapped keyboard controls in the supported key catalog order, then mouse controls in Left/Right/Middle order. Generated releases have a FocusLost reason and no pointer sample.
One event can create many logical edges; all normal frame and retained limits apply atomically. Later events in the same batch are still read. This is not a persistent focus-state flag or an input-routing layer.
Implementations§
Source§impl InputEvent
impl InputEvent
Sourcepub const fn key(key: PhysicalKeyCode, state: ButtonState) -> Self
pub const fn key(key: PhysicalKeyCode, state: ButtonState) -> Self
Creates a physical keyboard event for the headless or desktop adapter.
Sourcepub const fn pointer_moved(sample: PointerSample) -> Self
pub const fn pointer_moved(sample: PointerSample) -> Self
Creates an ordered pointer-position update, independent of bindings.
Sourcepub const fn relative_pointer_motion(motion: RelativePointerMotion) -> Self
pub const fn relative_pointer_motion(motion: RelativePointerMotion) -> Self
Supplies validated raw displacement; headless injection needs no OS capture.
Sourcepub const fn mouse_wheel(delta: ScrollDelta) -> Self
pub const fn mouse_wheel(delta: ScrollDelta) -> Self
Supplies a validated, ordered wheel event for frame-update consumers.
Creates a mouse-button event. Its logical edge captures the latest preceding pointer sample, or None when no position is known.
Trait Implementations§
Source§impl Clone for InputEvent
impl Clone for InputEvent
impl Copy for InputEvent
Source§impl Debug for InputEvent
impl Debug for InputEvent
impl Eq for InputEvent
Source§impl Hash for InputEvent
impl Hash for InputEvent
Source§impl PartialEq for InputEvent
impl PartialEq for InputEvent
impl StructuralPartialEq for InputEvent
Auto Trait Implementations§
impl Freeze for InputEvent
impl RefUnwindSafe for InputEvent
impl Send for InputEvent
impl Sync for InputEvent
impl Unpin for InputEvent
impl UnsafeUnpin for InputEvent
impl UnwindSafe for InputEvent
Blanket Implementations§
impl<T> Action for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.