pub struct KeyEvent {
pub code: KeyCode,
pub modifiers: KeyModifiers,
pub kind: KeyEventKind,
}Expand description
Keyboard input event.
Fields§
§code: KeyCodeThe key code.
modifiers: KeyModifiersModifiers held down during the event.
kind: KeyEventKindWhether this is a press, auto-repeat, or release.
Backends that cannot distinguish these always report
KeyEventKind::Press. See KeyEventKind for per-backend behavior.
Implementations§
Source§impl KeyEvent
impl KeyEvent
Sourcepub const fn new(code: KeyCode, modifiers: KeyModifiers) -> Self
pub const fn new(code: KeyCode, modifiers: KeyModifiers) -> Self
Creates a key press event with the given code and modifiers.
Sourcepub const fn with_kind(
code: KeyCode,
modifiers: KeyModifiers,
kind: KeyEventKind,
) -> Self
pub const fn with_kind( code: KeyCode, modifiers: KeyModifiers, kind: KeyEventKind, ) -> Self
Creates a key event with an explicit KeyEventKind.
Trait Implementations§
impl Copy for KeyEvent
impl Eq for KeyEvent
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 UnsafeUnpin 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