pub enum KeyCode {
Show 83 variants Char(char), Hyper, Super, Meta, Cancel, Backspace, Tab, Clear, Enter, Shift, Escape, LeftShift, RightShift, Control, LeftControl, RightControl, Alt, LeftAlt, RightAlt, Menu, LeftMenu, RightMenu, Pause, CapsLock, PageUp, PageDown, End, Home, LeftArrow, RightArrow, UpArrow, DownArrow, Select, Print, Execute, PrintScreen, Insert, Delete, Help, LeftWindows, RightWindows, Applications, Sleep, Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Numpad7, Numpad8, Numpad9, Multiply, Add, Separator, Subtract, Decimal, Divide, Function(u8), NumLock, ScrollLock, Copy, Cut, Paste, BrowserBack, BrowserForward, BrowserRefresh, BrowserStop, BrowserSearch, BrowserFavorites, BrowserHome, VolumeMute, VolumeDown, VolumeUp, MediaNextTrack, MediaPrevTrack, MediaStop, MediaPlayPause, ApplicationLeftArrow, ApplicationRightArrow, ApplicationUpArrow, ApplicationDownArrow, // some variants omitted
}
Expand description

Which key is pressed. Not all of these are probable to appear on most systems. A lot of this list is @wez trawling docs and making an entry for things that might be possible in this first pass.

Variants

Char(char)

The decoded unicode character

Hyper

Super

Meta

Cancel

Ctrl-break on windows

Backspace

Tab

Clear

Enter

Shift

Escape

LeftShift

RightShift

Control

LeftControl

RightControl

Alt

LeftAlt

RightAlt

Menu

LeftMenu

RightMenu

Pause

CapsLock

PageUp

PageDown

End

Home

LeftArrow

RightArrow

UpArrow

DownArrow

Select

Print

Execute

PrintScreen

Insert

Delete

Help

LeftWindows

RightWindows

Applications

Sleep

Numpad0

Numpad1

Numpad2

Numpad3

Numpad4

Numpad5

Numpad6

Numpad7

Numpad8

Numpad9

Multiply

Add

Separator

Subtract

Decimal

Divide

Function(u8)

F1-F24 are possible

NumLock

ScrollLock

Copy

Cut

Paste

BrowserBack

BrowserForward

BrowserRefresh

BrowserStop

BrowserSearch

BrowserFavorites

BrowserHome

VolumeMute

VolumeDown

VolumeUp

MediaNextTrack

MediaPrevTrack

MediaStop

MediaPlayPause

ApplicationLeftArrow

ApplicationRightArrow

ApplicationUpArrow

ApplicationDownArrow

Implementations

if SHIFT is held and we have KeyCode::Char(‘c’) we want to normalize that keycode to KeyCode::Char(‘C’); that is what this function does. In theory we should give the same treatment to keys like [ -> { but that assumes something about the keyboard layout and is probably better done in the gui frontend rather than this layer. In fact, this function might be better off if it lived elsewhere.

Return true if the key represents a modifier key.

Returns the byte sequence that represents this KeyCode and Modifier combination,

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.