pub enum Key {
Show 17 variants Backspace, Enter, Escape, Tab, Up, Down, Left, Right, Delete, Insert, Home, End, PageUp, PageDown, Char(char), Ctrl(char), F(u32),
}
Expand description

Represents a keyboard key press event

Variants

Backspace

Backspace

Enter

Enter

Escape

Escape

Tab

Tab

Up

Up arrow

Down

Down arrow

Left

Left arrow

Right

Right arrow

Delete

Delete

Insert

Insert

Home

Home

End

End

PageUp

PageUp

PageDown

PageDown

Char(char)

Character key

Ctrl(char)

Control character

Notes

The contained char value must always be lowercase; e.g. Ctrl('a') and not Ctrl('A').

On Unix, certain special Key values are represented as control characters; therefore, the following combinations will not generate a Ctrl(_) value:

  • Ctrl-I instead generates Tab
  • Ctrl-J and Ctrl-M instead generate Enter

F(u32)

Function n key; e.g. F1, F2, …

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

Performs the conversion.

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

This method tests for !=.

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.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.