#[non_exhaustive]pub enum PhysicalKey {
Show 127 variants
Backquote,
Backslash,
BracketLeft,
BracketRight,
Comma,
Digit0,
Digit1,
Digit2,
Digit3,
Digit4,
Digit5,
Digit6,
Digit7,
Digit8,
Digit9,
Equal,
IntlBackslash,
IntlRo,
IntlYen,
KeyA,
KeyB,
KeyC,
KeyD,
KeyE,
KeyF,
KeyG,
KeyH,
KeyI,
KeyJ,
KeyK,
KeyL,
KeyM,
KeyN,
KeyO,
KeyP,
KeyQ,
KeyR,
KeyS,
KeyT,
KeyU,
KeyV,
KeyW,
KeyX,
KeyY,
KeyZ,
Minus,
Period,
Quote,
Semicolon,
Slash,
AltLeft,
AltRight,
Backspace,
CapsLock,
ContextMenu,
ControlLeft,
ControlRight,
Enter,
MetaLeft,
MetaRight,
ShiftLeft,
ShiftRight,
Space,
Tab,
Delete,
End,
Help,
Home,
Insert,
PageDown,
PageUp,
ArrowDown,
ArrowLeft,
ArrowRight,
ArrowUp,
NumLock,
Numpad0,
Numpad1,
Numpad2,
Numpad3,
Numpad4,
Numpad5,
Numpad6,
Numpad7,
Numpad8,
Numpad9,
NumpadAdd,
NumpadBackspace,
NumpadClear,
NumpadComma,
NumpadDecimal,
NumpadDivide,
NumpadEnter,
NumpadEqual,
NumpadMultiply,
NumpadParenLeft,
NumpadParenRight,
NumpadSubtract,
Escape,
PrintScreen,
ScrollLock,
Pause,
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
F10,
F11,
F12,
F13,
F14,
F15,
F16,
F17,
F18,
F19,
F20,
F21,
F22,
F23,
F24,
Unidentified,
}Expand description
The physical key — the layout-independent position on the board,
mirroring the W3C UI Events
KeyboardEvent.code set
(KeyA, Numpad1, ShiftRight, F14). Unlike LogicalKey this
does not change with keyboard layout or held modifiers: the key west
of KeyS is KeyA on QWERTY, AZERTY, and Dvorak alike.
This is the right facet for rebindable controls, WASD-style movement,
global hotkeys, and telling duplicate keys apart (numpad Enter vs
the main Enter, ShiftLeft vs ShiftRight) — none of which the
logical key or the modifier mask can distinguish.
Hosts that cannot report a position use PhysicalKey::Unidentified.
Names follow the W3C code spelling (e.g. MetaLeft/MetaRight, not
winit’s SuperLeft/SuperRight).
#[non_exhaustive]: match with a wildcard arm, and test mapper
coverage against PhysicalKey::ALL. Per-variant docs are omitted —
the names are the W3C code spec names and self-describing.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Backquote
Backslash
BracketLeft
BracketRight
Comma
Digit0
Digit1
Digit2
Digit3
Digit4
Digit5
Digit6
Digit7
Digit8
Digit9
Equal
IntlBackslash
IntlRo
IntlYen
KeyA
KeyB
KeyC
KeyD
KeyE
KeyF
KeyG
KeyH
KeyI
KeyJ
KeyK
KeyL
KeyM
KeyN
KeyO
KeyP
KeyQ
KeyR
KeyS
KeyT
KeyU
KeyV
KeyW
KeyX
KeyY
KeyZ
Minus
Period
Quote
Semicolon
Slash
AltLeft
AltRight
Backspace
CapsLock
ContextMenu
ControlLeft
ControlRight
Enter
MetaLeft
MetaRight
ShiftLeft
ShiftRight
Space
Tab
Delete
End
Help
Home
Insert
PageDown
PageUp
ArrowDown
ArrowLeft
ArrowRight
ArrowUp
NumLock
Numpad0
Numpad1
Numpad2
Numpad3
Numpad4
Numpad5
Numpad6
Numpad7
Numpad8
Numpad9
NumpadAdd
NumpadBackspace
NumpadClear
NumpadComma
NumpadDecimal
NumpadDivide
NumpadEnter
NumpadEqual
NumpadMultiply
NumpadParenLeft
NumpadParenRight
NumpadSubtract
Escape
PrintScreen
ScrollLock
Pause
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
F13
F14
F15
F16
F17
F18
F19
F20
F21
F22
F23
F24
Unidentified
The host could not report a physical position for this key.
Implementations§
Source§impl PhysicalKey
impl PhysicalKey
Sourcepub const ALL: &'static [PhysicalKey]
pub const ALL: &'static [PhysicalKey]
Every variant, in declaration order.
The enum is #[non_exhaustive], so a host input mapper
cannot prove coverage with an exhaustive match; its
totality test iterates this slice instead (see
damascene-winit’s tests for the pattern).
Trait Implementations§
Source§impl Clone for PhysicalKey
impl Clone for PhysicalKey
Source§fn clone(&self) -> PhysicalKey
fn clone(&self) -> PhysicalKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PhysicalKey
Source§impl Debug for PhysicalKey
impl Debug for PhysicalKey
impl Eq for PhysicalKey
Source§impl Hash for PhysicalKey
impl Hash for PhysicalKey
Source§impl PartialEq for PhysicalKey
impl PartialEq for PhysicalKey
impl StructuralPartialEq for PhysicalKey
Auto Trait Implementations§
impl Freeze for PhysicalKey
impl RefUnwindSafe for PhysicalKey
impl Send for PhysicalKey
impl Sync for PhysicalKey
impl Unpin for PhysicalKey
impl UnsafeUnpin for PhysicalKey
impl UnwindSafe for PhysicalKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.