pub struct KeyEvent {
pub state: KeyState,
pub key: Key,
pub modifiers: Modifiers,
pub repeat: bool,
pub pointer_pos: Option<Point>,
pub text: Option<String>,
}Expand description
Keyboard input event in logical coordinates.
§Examples
use ailloli_ui_core::event::{Key, KeyEvent, KeyState, Modifiers};
let event = KeyEvent {
state: KeyState::Pressed,
key: Key::Character("a".into()),
modifiers: Modifiers::default(),
repeat: false,
pointer_pos: None,
text: Some("a".into()),
};
assert_eq!(event.text.as_deref(), Some("a"));Fields§
§state: KeyStatePress or release transition.
key: KeyProvider-normalized logical key.
modifiers: ModifiersModifier snapshot observed with this transition.
repeat: booltrue when the OS reports auto-repeat.
pointer_pos: Option<Point>Cursor position in logical window coordinates at event time, if known.
text: Option<String>Committed or composed text from the platform, when provided.
None means no text payload was supplied; Some("") preserves an
explicitly supplied empty payload.
Trait Implementations§
impl StructuralPartialEq for KeyEvent
Auto Trait Implementations§
impl Freeze for KeyEvent
impl RefUnwindSafe for KeyEvent
impl Send for KeyEvent
impl Sync for KeyEvent
impl Unpin for KeyEvent
impl UnwindSafe for KeyEvent
Blanket Implementations§
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
Mutably borrows from an owned value. Read more