跳到主要内容

Key

搜索

枚举Key 

Source
pub enum Key {
Show 106 variants Alt, AltGr, Backspace, CapsLock, ControlLeft, ControlRight, Delete, DownArrow, End, Escape, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, Home, LeftArrow, MetaLeft, MetaRight, PageDown, PageUp, Return, RightArrow, ShiftLeft, ShiftRight, Space, Tab, UpArrow, PrintScreen, ScrollLock, Pause, NumLock, BackQuote, Num1, Num2, Num3, Num4, Num5, Num6, Num7, Num8, Num9, Num0, Minus, Equal, KeyQ, KeyW, KeyE, KeyR, KeyT, KeyY, KeyU, KeyI, KeyO, KeyP, LeftBracket, RightBracket, KeyA, KeyS, KeyD, KeyF, KeyG, KeyH, KeyJ, KeyK, KeyL, SemiColon, Quote, BackSlash, IntlBackslash, KeyZ, KeyX, KeyC, KeyV, KeyB, KeyN, KeyM, Comma, Dot, Slash, Insert, KpReturn, KpMinus, KpPlus, KpMultiply, KpDivide, Kp0, Kp1, Kp2, Kp3, Kp4, Kp5, Kp6, Kp7, Kp8, Kp9, KpDelete, Function, Unknown(u32),
}
展开描述

键名基于设备上的物理位置。将 Option(MacOS)和 Alt(Windows、Linux)合并为 Alt;将 Windows(Windows)、Meta(Linux)、Command(MacOS)合并为 Meta。字符基于 QWERTY 布局,不要直接将其作为字符使用,因为结果会随布局变化。如需真实字符,请使用 Event.name。修饰键也会改变这些键的值。注意,Windows 上不存在 KpReturn,它严格等同于 Return。此外,数字小键盘的键在 NumLock 关闭时会被改写,等同于 PageDown 等功能键。

变体§

§

Alt

Linux 和 Windows 上的 Alt 键(macOS 上的 Option 键)

§

AltGr

§

Backspace

§

CapsLock

§

ControlLeft

§

ControlRight

§

Delete

§

DownArrow

§

End

§

Escape

§

F1

§

F10

§

F11

§

F12

§

F2

§

F3

§

F4

§

F5

§

F6

§

F7

§

F8

§

F9

§

Home

§

LeftArrow

§

MetaLeft

也称为 “windows”、“super” 和 “command”

§

MetaRight

也称为 “windows”、“super” 和 “command”

§

PageDown

§

PageUp

§

Return

§

RightArrow

§

ShiftLeft

§

ShiftRight

§

Space

§

Tab

§

UpArrow

§

PrintScreen

§

ScrollLock

§

Pause

§

NumLock

§

BackQuote

§

Num1

§

Num2

§

Num3

§

Num4

§

Num5

§

Num6

§

Num7

§

Num8

§

Num9

§

Num0

§

Minus

§

Equal

§

KeyQ

§

KeyW

§

KeyE

§

KeyR

§

KeyT

§

KeyY

§

KeyU

§

KeyI

§

KeyO

§

KeyP

§

LeftBracket

§

RightBracket

§

KeyA

§

KeyS

§

KeyD

§

KeyF

§

KeyG

§

KeyH

§

KeyJ

§

KeyK

§

KeyL

§

SemiColon

§

Quote

§

BackSlash

§

IntlBackslash

§

KeyZ

§

KeyX

§

KeyC

§

KeyV

§

KeyB

§

KeyN

§

KeyM

§

Comma

§

Dot

§

Slash

§

Insert

§

KpReturn

§

KpMinus

§

KpPlus

§

KpMultiply

§

KpDivide

§

Kp0

§

Kp1

§

Kp2

§

Kp3

§

Kp4

§

Kp5

§

Kp6

§

Kp7

§

Kp8

§

Kp9

§

KpDelete

§

Function

§

Unknown(u32)

Trait 实现§

Source§

impl Clone for Key

Source§

fn clone(&self) -> Key

返回该值的一个副本。阅读更多
1.0.0 · Source§

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

执行从 source. 阅读更多
Source§

impl Debug for Key

Source§

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

使用给定的格式化器格式化该值。阅读更多
Source§

impl Hash for Key

Source§

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

Feeds this value into the given Hasher. 阅读更多
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. 阅读更多
Source§

impl PartialEq for Key

Source§

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

测试 selfother 的值是否相等,并由 == 使用。
1.0.0 · Source§

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

测试 !=。默认实现几乎总是足够的,除非有非常充分的理由,否则不应被重写。
Source§

impl Copy for Key

Source§

impl Eq for Key

Source§

impl StructuralPartialEq for Key

自动 Trait 实现§

§

impl Freeze for Key

§

impl RefUnwindSafe for Key

§

impl Send for Key

§

impl Sync for Key

§

impl Unpin for Key

§

impl UnsafeUnpin for Key

§

impl UnwindSafe for Key

通用实现§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. 阅读更多
Source§

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

Source§

fn borrow(&self) -> &T

对拥有的值进行不可变借用。阅读更多
Source§

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

Source§

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

对拥有的值进行可变借用。阅读更多
Source§

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

Source§

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

🔬这是一个仅在 nightly 可见的实验性 API。(clone_to_uninit)
执行从 self to dest. 阅读更多
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

原样返回参数。

Source§

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

Source§

fn into(self) -> U

调用 U::from(self)

That is, this conversion is whatever the implementation of From<T> for U 的实现自行决定。

Source§

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

Source§

type Owned = T

获取所有权后得到的类型。
Source§

fn to_owned(&self) -> T

从借用的数据创建拥有的数据,通常通过克隆完成。阅读更多
Source§

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

使用借用的数据替换拥有的数据,通常通过克隆完成。阅读更多
Source§

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

Source§

type Error = Infallible

转换失败时返回的类型。
Source§

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

执行转换。
Source§

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

Source§

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

转换失败时返回的类型。
Source§

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

执行转换。