pub struct KeyEvent {
pub code: KeyCode,
pub modifiers: KeyModifiers,
pub kind: KeyEventKind,
pub state: KeyEventState,
}
Expand description
Represents a key event.
Fields
code: KeyCode
The key itself.
modifiers: KeyModifiers
Additional key modifiers.
kind: KeyEventKind
Kind of event.
state: KeyEventState
Keyboard state.
Only set if KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES
has been enabled with
PushKeyboardEnhancementFlags
.
Implementations
sourceimpl KeyEvent
impl KeyEvent
pub const fn new(code: KeyCode, modifiers: KeyModifiers) -> KeyEvent
pub const fn new_with_kind(
code: KeyCode,
modifiers: KeyModifiers,
kind: KeyEventKind
) -> KeyEvent
pub const fn new_with_kind_and_state(
code: KeyCode,
modifiers: KeyModifiers,
kind: KeyEventKind,
state: KeyEventState
) -> KeyEvent
Trait Implementations
sourceimpl<'de> Deserialize<'de> for KeyEvent
impl<'de> Deserialize<'de> for KeyEvent
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialOrd<KeyEvent> for KeyEvent
impl PartialOrd<KeyEvent> for KeyEvent
sourcefn partial_cmp(&self, other: &KeyEvent) -> Option<Ordering>
fn partial_cmp(&self, other: &KeyEvent) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for KeyEvent
impl Eq for KeyEvent
Auto Trait Implementations
impl RefUnwindSafe for KeyEvent
impl Send for KeyEvent
impl Sync for KeyEvent
impl Unpin for KeyEvent
impl UnwindSafe for KeyEvent
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more