pub struct KeyEvent {
pub chord: KeyChord,
pub kind: KeyKind,
pub text: Option<char>,
}Expand description
A key event.
Fields§
§chord: KeyChordThe key and modifiers, normalised for keymap matching: letters are lowercase with
shift set when typed uppercase.
kind: KeyKindDown, repeat or up.
text: Option<char>The character to insert when typing, if this key produces one.
Implementations§
Source§impl KeyEvent
impl KeyEvent
Sourcepub fn press(chord: &str) -> Self
pub fn press(chord: &str) -> Self
A key press from a chord such as "ctrl+s", with the character it types.
§Panics
Panics when chord is not a valid chord; meant for tests and fixed bindings.
Sourcepub fn from_chord(chord: KeyChord) -> Self
pub fn from_chord(chord: KeyChord) -> Self
A press of chord; text is derived from plain character and space keys.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more