Struct KeyEvent

pub struct KeyEvent(pub KeyCode, pub Modifiers);

Input key pressed and modifiers

Fields

0: KeyCode
1: Modifiers

Implementations

impl KeyEvent

fn new(c: char, mods: Modifiers) -> Self

Constructor from char and modifiers

fn ctrl(c: char) -> Self

Constructor from char with Ctrl modifier

fn alt(c: char) -> Self

Constructor from char with Alt modifier

fn normalize(e: Self) -> Self

ctrl-a => ctrl-A (uppercase) shift-A => A (no SHIFT modifier) shift-Tab => BackTab

Trait Implementations

impl Clone for KeyEvent

fn clone(&self) -> KeyEvent

impl Copy for KeyEvent

impl Debug for KeyEvent

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Eq for KeyEvent

impl From<char> for KeyEvent

fn from(c: char) -> Self

impl Hash for KeyEvent

fn hash<__H: Hasher>(&self, state: &mut __H)

impl PartialEq for KeyEvent

fn eq(&self, other: &KeyEvent) -> bool

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

impl<T> Any for KeyEvent where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for KeyEvent where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for KeyEvent where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for KeyEvent where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for KeyEvent

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for KeyEvent where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for KeyEvent where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for KeyEvent where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for KeyEvent where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>