Skip to main content

KeyType

Enum KeyType 

Source
#[repr(i16)]
pub enum KeyType {
Show 89 variants Null = 0, CtrlA = 1, CtrlB = 2, CtrlC = 3, CtrlD = 4, CtrlE = 5, CtrlF = 6, CtrlG = 7, CtrlH = 8, Tab = 9, CtrlJ = 10, CtrlK = 11, CtrlL = 12, Enter = 13, CtrlN = 14, CtrlO = 15, CtrlP = 16, CtrlQ = 17, CtrlR = 18, CtrlS = 19, CtrlT = 20, CtrlU = 21, CtrlV = 22, CtrlW = 23, CtrlX = 24, CtrlY = 25, CtrlZ = 26, Esc = 27, CtrlBackslash = 28, CtrlCloseBracket = 29, CtrlCaret = 30, CtrlUnderscore = 31, Backspace = 127, Runes = -1, Up = -2, Down = -3, Right = -4, Left = -5, ShiftTab = -6, Home = -7, End = -8, PgUp = -9, PgDown = -10, CtrlPgUp = -11, CtrlPgDown = -12, Delete = -13, Insert = -14, Space = -15, CtrlUp = -16, CtrlDown = -17, CtrlRight = -18, CtrlLeft = -19, CtrlHome = -20, CtrlEnd = -21, ShiftUp = -22, ShiftDown = -23, ShiftRight = -24, ShiftLeft = -25, ShiftHome = -26, ShiftEnd = -27, CtrlShiftUp = -28, CtrlShiftDown = -29, CtrlShiftLeft = -30, CtrlShiftRight = -31, CtrlShiftHome = -32, CtrlShiftEnd = -33, F1 = -34, F2 = -35, F3 = -36, F4 = -37, F5 = -38, F6 = -39, F7 = -40, F8 = -41, F9 = -42, F10 = -43, F11 = -44, F12 = -45, F13 = -46, F14 = -47, F15 = -48, F16 = -49, F17 = -50, F18 = -51, F19 = -52, F20 = -53, ShiftEnter = -54, CtrlEnter = -55, CtrlShiftEnter = -56,
}
Expand description

Key type enumeration.

Represents different types of keys that can be pressed.

Variants§

§

Null = 0

Null character (Ctrl+@).

§

CtrlA = 1

Ctrl+A.

§

CtrlB = 2

Ctrl+B.

§

CtrlC = 3

Break/Interrupt (Ctrl+C).

§

CtrlD = 4

Ctrl+D (EOF).

§

CtrlE = 5

Ctrl+E.

§

CtrlF = 6

Ctrl+F.

§

CtrlG = 7

Ctrl+G (Bell).

§

CtrlH = 8

Ctrl+H (Backspace on some systems).

§

Tab = 9

Tab (Ctrl+I).

§

CtrlJ = 10

Ctrl+J (Line feed).

§

CtrlK = 11

Ctrl+K.

§

CtrlL = 12

Ctrl+L.

§

Enter = 13

Enter (Ctrl+M, Carriage return).

§

CtrlN = 14

Ctrl+N.

§

CtrlO = 15

Ctrl+O.

§

CtrlP = 16

Ctrl+P.

§

CtrlQ = 17

Ctrl+Q.

§

CtrlR = 18

Ctrl+R.

§

CtrlS = 19

Ctrl+S.

§

CtrlT = 20

Ctrl+T.

§

CtrlU = 21

Ctrl+U.

§

CtrlV = 22

Ctrl+V.

§

CtrlW = 23

Ctrl+W.

§

CtrlX = 24

Ctrl+X.

§

CtrlY = 25

Ctrl+Y.

§

CtrlZ = 26

Ctrl+Z.

§

Esc = 27

Escape (Ctrl+[).

§

CtrlBackslash = 28

Ctrl+.

§

CtrlCloseBracket = 29

Ctrl+].

§

CtrlCaret = 30

Ctrl+^.

§

CtrlUnderscore = 31

Ctrl+_.

§

Backspace = 127

Delete (127).

§

Runes = -1

Regular character(s) input.

§

Up = -2

Up arrow.

§

Down = -3

Down arrow.

§

Right = -4

Right arrow.

§

Left = -5

Left arrow.

§

ShiftTab = -6

Shift+Tab.

§

Home = -7

Home key.

§

End = -8

End key.

§

PgUp = -9

Page Up.

§

PgDown = -10

Page Down.

§

CtrlPgUp = -11

Ctrl+Page Up.

§

CtrlPgDown = -12

Ctrl+Page Down.

§

Delete = -13

Delete key.

§

Insert = -14

Insert key.

§

Space = -15

Space key.

§

CtrlUp = -16

Ctrl+Up.

§

CtrlDown = -17

Ctrl+Down.

§

CtrlRight = -18

Ctrl+Right.

§

CtrlLeft = -19

Ctrl+Left.

§

CtrlHome = -20

Ctrl+Home.

§

CtrlEnd = -21

Ctrl+End.

§

ShiftUp = -22

Shift+Up.

§

ShiftDown = -23

Shift+Down.

§

ShiftRight = -24

Shift+Right.

§

ShiftLeft = -25

Shift+Left.

§

ShiftHome = -26

Shift+Home.

§

ShiftEnd = -27

Shift+End.

§

CtrlShiftUp = -28

Ctrl+Shift+Up.

§

CtrlShiftDown = -29

Ctrl+Shift+Down.

§

CtrlShiftLeft = -30

Ctrl+Shift+Left.

§

CtrlShiftRight = -31

Ctrl+Shift+Right.

§

CtrlShiftHome = -32

Ctrl+Shift+Home.

§

CtrlShiftEnd = -33

Ctrl+Shift+End.

§

F1 = -34

F1.

§

F2 = -35

F2.

§

F3 = -36

F3.

§

F4 = -37

F4.

§

F5 = -38

F5.

§

F6 = -39

F6.

§

F7 = -40

F7.

§

F8 = -41

F8.

§

F9 = -42

F9.

§

F10 = -43

F10.

§

F11 = -44

F11.

§

F12 = -45

F12.

§

F13 = -46

F13.

§

F14 = -47

F14.

§

F15 = -48

F15.

§

F16 = -49

F16.

§

F17 = -50

F17.

§

F18 = -51

F18.

§

F19 = -52

F19.

§

F20 = -53

F20.

§

ShiftEnter = -54

Shift+Enter.

§

CtrlEnter = -55

Ctrl+Enter.

§

CtrlShiftEnter = -56

Ctrl+Shift+Enter.

Implementations§

Source§

impl KeyType

Source

pub fn is_ctrl(&self) -> bool

Check if this key type represents a control character.

Source

pub fn is_function_key(&self) -> bool

Check if this is a function key (F1-F20).

Source

pub fn is_cursor(&self) -> bool

Check if this is a cursor movement key.

Trait Implementations§

Source§

impl Clone for KeyType

Source§

fn clone(&self) -> KeyType

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for KeyType

Source§

impl Debug for KeyType

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for KeyType

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for KeyType

Source§

impl Hash for KeyType

Source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for KeyType

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for KeyType

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more