pub struct KeyEvent {
pub code: KeyCode,
pub modifiers: Modifiers,
pub kind: KeyEventKind,
}Expand description
A keyboard event.
Fields§
§code: KeyCodeThe key code that was pressed.
modifiers: ModifiersModifier keys held during the event.
kind: KeyEventKindThe type of key event (press, repeat, or release).
Implementations§
Source§impl KeyEvent
impl KeyEvent
Sourcepub const fn new(code: KeyCode) -> Self
pub const fn new(code: KeyCode) -> Self
Create a new key event with default modifiers and Press kind.
Sourcepub const fn with_modifiers(self, modifiers: Modifiers) -> Self
pub const fn with_modifiers(self, modifiers: Modifiers) -> Self
Create a key event with modifiers.
Sourcepub const fn with_kind(self, kind: KeyEventKind) -> Self
pub const fn with_kind(self, kind: KeyEventKind) -> Self
Create a key event with a specific kind.
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