pub enum NativeKey {
Unidentified,
Android(u32),
MacOS(u16),
Windows(u16),
Xkb(u32),
Web(SmolStr),
}
Expand description
Contains the platform-native logical key identifier
Exactly what that means differs from platform to platform, but the values are to some degree tied to the currently active keyboard layout. The same key on the same keyboard may also report different values on different platforms, which is one of the reasons this is a per-platform enum.
This enum is primarily used to store raw keysym when Winit doesn’t map a given native logical
key identifier to a meaningful Key
variant. This lets you use Key
, and let the user
define keybinds which work in the presence of identifiers we haven’t mapped for you yet.
Variants§
Unidentified
Android(u32)
An Android “keycode”, which is similar to a “virtual-key code” on Windows.
MacOS(u16)
A macOS “scancode”. There does not appear to be any direct analogue to either keysyms or “virtual-key” codes in macOS, so we report the scancode instead.
Windows(u16)
A Windows “virtual-key code”.
Xkb(u32)
An XKB “keysym”.
Web(SmolStr)
A “key value string”.
Trait Implementations§
source§impl From<NativeKeyCode> for NativeKey
impl From<NativeKeyCode> for NativeKey
source§fn from(code: NativeKeyCode) -> Self
fn from(code: NativeKeyCode) -> Self
source§impl Ord for NativeKey
impl Ord for NativeKey
source§impl<Str> PartialEq<Key<Str>> for NativeKey
impl<Str> PartialEq<Key<Str>> for NativeKey
source§impl<Str> PartialEq<NativeKey> for Key<Str>
impl<Str> PartialEq<NativeKey> for Key<Str>
source§impl PartialEq<NativeKey> for NativeKeyCode
impl PartialEq<NativeKey> for NativeKeyCode
source§impl PartialEq<NativeKeyCode> for NativeKey
impl PartialEq<NativeKeyCode> for NativeKey
source§fn eq(&self, rhs: &NativeKeyCode) -> bool
fn eq(&self, rhs: &NativeKeyCode) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq for NativeKey
impl PartialEq for NativeKey
source§impl PartialOrd for NativeKey
impl PartialOrd for NativeKey
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more