pub enum Key {
Show 202 variants Unknown, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, Key1, Key2, Key3, Key4, Key5, Key6, Key7, Key8, Key9, Key0, Enter, Escape, Backspace, Tab, Space, Minus, Equals, LeftBrace, RightBrace, Backslash, NonUsHash, Semicolon, Apostrophe, GraveAccent, Comma, Dot, Slash, CapsLock, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PrintScreen, ScrollLock, Pause, Insert, Home, PageUp, Delete, End, PageDown, Right, Left, Down, Up, NumLock, KeypadSlash, KeypadAsterisk, KeypadMinus, KeypadPlus, KeypadEnter, Keypad1, Keypad2, Keypad3, Keypad4, Keypad5, Keypad6, Keypad7, Keypad8, Keypad9, Keypad0, KeypadDot, NonUsBackslash, KeypadEquals, Menu, LeftCtrl, LeftShift, LeftAlt, LeftMeta, RightCtrl, RightShift, RightAlt, RightMeta, Mute, VolumeDown, VolumeUp, PlayPause, MediaMute, MediaVolumeIncrement, MediaVolumeDecrement, AcBack, AcRefresh, AcFullScreenView, AcSelectTaskApplication, BrightnessDown, BrightnessUp, Assistant, Power, Unknown0055, Unknown0056, Unknown0059, Unknown005C, Unknown005D, Unknown005E, Unknown0079, Unknown007A, Unknown007B, Unknown007C, Unknown0085, Unknown0087, Unknown0089, Unknown009C, Unknown009F, Unknown00A0, Unknown00A2, Unknown00A3, Unknown00A5, Unknown00A6, Unknown00A7, Unknown00A8, Unknown00A9, Unknown00Ad, Unknown00B1, Unknown00B2, Unknown00B3, Unknown00B4, Unknown00C9, Unknown00Cf, Unknown00D0, Unknown00D4, Unknown00E2, Unknown0120, Unknown0121, Unknown0122, Unknown0123, Unknown0124, Unknown0125, Unknown0126, Unknown0127, Unknown0128, Unknown0129, Unknown012A, Unknown012B, Unknown012C, Unknown012D, Unknown012E, Unknown012F, Unknown0130, Unknown0131, Unknown0132, Unknown0133, Unknown0134, Unknown0135, Unknown0136, Unknown0137, Unknown0138, Unknown0139, Unknown013A, Unknown013B, Unknown013C, Unknown013D, Unknown013E, Unknown0161, Unknown016A, Unknown016E, Unknown0172, Unknown0179, Unknown018E, Unknown018F, Unknown0190, Unknown0191, Unknown0192, Unknown0193, Unknown0195, Unknown01D0, Unknown020A, Unknown020B, // some variants omitted
}
Expand description

A Fuchsia key represents a control that can be pressed or released such as a key or a button on a keyboard or another input device.

The ordinal index for enum elements is derived from the USB HID Usage Tables at the time of definition. It is a 32 bit unsigned integer representing the USB HID Usage where the low 16 bits are the USB HID Usage ID and the high 16 bits are the USB HID Usage Page.

The descriptions for each value in the enum assume a US English keyboard layout. Actual behavior varies by layout.

Variants§

§

Unknown

Used when the value of Key is not known.

§

A

Keyboard a and A

§

B

Keyboard b and B

§

C

Keyboard c and C

§

D

Keyboard d and D

§

E

Keyboard e and E

§

F

Keyboard f and F

§

G

Keyboard g and G

§

H

Keyboard h and H

§

I

Keyboard i and I

§

J

Keyboard j and J

§

K

Keyboard k and K

§

L

Keyboard l and L

§

M

Keyboard m and M

§

N

Keyboard n and N

§

O

Keyboard o and O

§

P

Keyboard p and P

§

Q

Keyboard q and Q

§

R

Keyboard r and R

§

S

Keyboard s and S

§

T

Keyboard t and T

§

U

Keyboard u and U

§

V

Keyboard v and V

§

W

Keyboard w and W

§

X

Keyboard x and X

§

Y

Keyboard y and Y

§

Z

Keyboard z and Z

§

Key1

Keyboard 1 and !

§

Key2

Keyboard 2 and @

§

Key3

Keyboard 3 and #

§

Key4

Keyboard 4 and $

§

Key5

Keyboard 5 and %

§

Key6

Keyboard 6 and ^

§

Key7

Keyboard 7 and &

§

Key8

Keyboard 8 and *

§

Key9

Keyboard 9 and (

§

Key0

Keyboard 0 and )

§

Enter

Keyboard Enter (Return)

§

Escape

Keyboard Escape

§

Backspace

Keyboard Backspace (Backward Delete)

§

Tab

Keyboard Tab

§

Space

Keyboard Spacebar

§

Minus

Keyboard - and (underscore)

§

Equals

Keyboard = and +

§

LeftBrace

Keyboard [ and {

§

RightBrace

Keyboard ] and }

§

Backslash

Keyboard \ and |

§

NonUsHash

Keyboard Non-US # and ~

§

Semicolon

Keyboard ; and :

§

Apostrophe

Keyboard ’ and “

§

GraveAccent

Keyboard Grave Accent and Tilde

§

Comma

Keyboard , and <

§

Dot

Keyboard . and >

§

Slash

Keyboard / and ?

§

CapsLock

Keyboard Caps Lock

§

F1

Keyboard F1

§

F2

Keyboard F2

§

F3

Keyboard F3

§

F4

Keyboard F4

§

F5

Keyboard F5

§

F6

Keyboard F6

§

F7

Keyboard F7

§

F8

Keyboard F8

§

F9

Keyboard F9

§

F10

Keyboard F10

§

F11

Keyboard F11

§

F12

Keyboard F12

§

PrintScreen

Keyboard Print Screen

§

ScrollLock

Keyboard Scroll Lock

§

Pause

Keyboard Pause

§

Insert

Keyboard Insert

§

Home

Keyboard Home

§

PageUp

Keyboard Page Up

§

Delete

Keyboard Forward Delete

§

End

Keyboard End

§

PageDown

Keyboard Page Down

§

Right

Keyboard Right Arrow

§

Left

Keyboard Left Arrow

§

Down

Keyboard Down Arrow

§

Up

Keyboard Up Arrow

§

NumLock

Keypad Num Lock and Clear

§

KeypadSlash

Keypad /

§

KeypadAsterisk

Keypad *

§

KeypadMinus

Keypad -

§

KeypadPlus

Keypad +

§

KeypadEnter

Keypad ENTER

§

Keypad1

Keypad 1 and End

§

Keypad2

Keypad 2 and Down Arrow

§

Keypad3

Keypad 3 and Page Down

§

Keypad4

Keypad 4 and Left Arrow

§

Keypad5

Keypad 5

§

Keypad6

Keypad 6 and Right Arrow

§

Keypad7

Keypad 7 and Home

§

Keypad8

Keypad 8 and Up Arrow

§

Keypad9

Keypad 9 and Page Up

§

Keypad0

Keypad 0 and Insert

§

KeypadDot

Keypad . and Delete

§

NonUsBackslash

Keyboard Non-US \ and |

§

KeypadEquals

Keypad =

§

Menu

Keyboard Menu

§

LeftCtrl

Keyboard Left Control

§

LeftShift

Keyboard Left Shift

§

LeftAlt

Keyboard Left Alt

§

LeftMeta

Keyboard Left GUI (Meta, Windows)

§

RightCtrl

Keyboard Right Control

§

RightShift

Keyboard Right Shift

§

RightAlt

Keyboard Right Alt

§

RightMeta

Keyboard Right GUI (Meta, Windows)

§

Mute

Mute

Silences played sounds.

§

VolumeDown

Turn volume down

§

VolumeUp

Turn volume up

§

PlayPause

Play media, or pause media if playing

§

MediaMute

Media mute

Silences media playback. Other sounds may still be heard, e.g. system notification sounds.

§

MediaVolumeIncrement

Volume Increment

§

MediaVolumeDecrement

Volume Decrement

§

AcBack

Back

Go back to the previous page in the browser. This, and other action keys are defined in Chromium.

§

AcRefresh

Refresh

Refresh the current page in the browser.

§

AcFullScreenView

Full screen view

Zooms the focused window to full screen.

§

AcSelectTaskApplication

Select task/application

Shows the task selection window

§

BrightnessDown

Reduce screen brightness

§

BrightnessUp

Increase screen brightness

§

Assistant

NOTE: the following are self-defined and do not have to follow the HID usage pages. We use HID-Vendor-Specific page 0xFFFF to represent Fuchsia defined keys. Assistant Key.

§

Power

Power Button.

§

Unknown0055

Warning: following keycodes maybe changed in the future, please don’t use!!! We use following keycodes in starnix tests. Most of them are keycodes in non-US keyboard layouts, we may move them to meaning enum once we support those keyboard layouts. See b/311425670 for details.

§

Unknown0056

§

Unknown0059

§

Unknown005C

§

Unknown005D

§

Unknown005E

§

Unknown0079

§

Unknown007A

§

Unknown007B

§

Unknown007C

§

Unknown0085

§

Unknown0087

§

Unknown0089

§

Unknown009C

§

Unknown009F

§

Unknown00A0

§

Unknown00A2

§

Unknown00A3

§

Unknown00A5

§

Unknown00A6

§

Unknown00A7

§

Unknown00A8

§

Unknown00A9

§

Unknown00Ad

§

Unknown00B1

§

Unknown00B2

§

Unknown00B3

§

Unknown00B4

§

Unknown00C9

§

Unknown00Cf

§

Unknown00D0

§

Unknown00D4

§

Unknown00E2

§

Unknown0120

§

Unknown0121

§

Unknown0122

§

Unknown0123

§

Unknown0124

§

Unknown0125

§

Unknown0126

§

Unknown0127

§

Unknown0128

§

Unknown0129

§

Unknown012A

§

Unknown012B

§

Unknown012C

§

Unknown012D

§

Unknown012E

§

Unknown012F

§

Unknown0130

§

Unknown0131

§

Unknown0132

§

Unknown0133

§

Unknown0134

§

Unknown0135

§

Unknown0136

§

Unknown0137

§

Unknown0138

§

Unknown0139

§

Unknown013A

§

Unknown013B

§

Unknown013C

§

Unknown013D

§

Unknown013E

§

Unknown0161

§

Unknown016A

§

Unknown016E

§

Unknown0172

§

Unknown0179

§

Unknown018E

§

Unknown018F

§

Unknown0190

§

Unknown0191

§

Unknown0192

§

Unknown0193

§

Unknown0195

§

Unknown01D0

§

Unknown020A

§

Unknown020B

Implementations§

source§

impl Key

source

pub fn from_primitive(prim: u32) -> Option<Self>

source

pub fn from_primitive_allow_unknown(prim: u32) -> Self

source

pub fn unknown() -> Self

source

pub const fn into_primitive(self) -> u32

source

pub fn is_unknown(&self) -> bool

Trait Implementations§

source§

impl Clone for Key

source§

fn clone(&self) -> Key

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Key

source§

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

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

impl Decode<Key> for Key

source§

fn new_empty() -> Self

Creates a valid instance of Self. The specific value does not matter, since it will be overwritten by decode.
source§

unsafe fn decode( &mut self, decoder: &mut Decoder<'_>, offset: usize, _depth: Depth ) -> Result<()>

Decodes an object of type T from the decoder’s buffers into self. Read more
source§

impl Encode<Key> for Key

source§

unsafe fn encode( self, encoder: &mut Encoder<'_>, offset: usize, _depth: Depth ) -> Result<()>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl Hash for Key

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 Ord for Key

source§

fn cmp(&self, other: &Key) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Key

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Key

source§

fn partial_cmp(&self, other: &Key) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl TypeMarker for Key

§

type Owned = Key

The owned Rust type which this FIDL type decodes into.
source§

fn inline_align(_context: Context) -> usize

Returns the minimum required alignment of the inline portion of the encoded object. It must be a (nonzero) power of two.
source§

fn inline_size(_context: Context) -> usize

Returns the size of the inline portion of the encoded object, including padding for alignment. Must be a multiple of inline_align.
source§

fn encode_is_copy() -> bool

Returns true if the memory layout of Self::Owned matches the FIDL wire format and encoding requires no validation. When true, we can optimize encoding arrays and vectors of Self::Owned to a single memcpy. Read more
source§

fn decode_is_copy() -> bool

Returns true if the memory layout of Self::Owned matches the FIDL wire format and decoding requires no validation. When true, we can optimize decoding arrays and vectors of Self::Owned to a single memcpy.
source§

impl ValueTypeMarker for Key

§

type Borrowed<'a> = Key

The Rust type to use for encoding. This is a particular Encode<Self> type cheaply obtainable from &Self::Owned. There are three cases: Read more
source§

fn borrow<'a>(value: &'a <Self as TypeMarker>::Owned) -> Self::Borrowed<'a>

Cheaply converts from &Self::Owned to Self::Borrowed.
source§

impl Copy for Key

source§

impl Eq for Key

source§

impl StructuralPartialEq for Key

Auto Trait Implementations§

§

impl Freeze for Key

§

impl RefUnwindSafe for Key

§

impl Send for Key

§

impl Sync for Key

§

impl Unpin for Key

§

impl UnwindSafe for Key

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
§

impl<T> Encode<Ambiguous1> for T

§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<T> Encode<Ambiguous2> for T

§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<E> ErrorType for E
where E: ValueTypeMarker<Owned = E> + Decode<E>,

§

type Marker = E

The marker type.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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