pub enum NativeCode {
Unidentified,
Android(u32),
MacOS(u16),
Windows(u16),
Xkb(u32),
}
Expand description
Contains the platform-native physical key identifier.
The exact values vary from platform to platform (which is part of why this is a per-platform enum), but the values are primarily tied to the key’s physical location on the keyboard.
This enum is primarily used to store raw keycodes when Winit doesn’t map a given native
physical key identifier to a meaningful Code
variant. In the presence of identifiers we
haven’t mapped for you yet, this lets you use use Code
to:
- Correctly match key press and release events.
- On non-web platforms, support assigning keybinds to virtually any key through a UI.
Variants§
Unidentified
An unidentified code.
Android(u32)
An Android “scancode”.
MacOS(u16)
A macOS “scancode”.
Windows(u16)
A Windows “scancode”.
Xkb(u32)
An XKB “keycode”.
Trait Implementations§
Source§impl Clone for NativeCode
impl Clone for NativeCode
Source§fn clone(&self) -> NativeCode
fn clone(&self) -> NativeCode
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for NativeCode
impl Debug for NativeCode
Source§impl Hash for NativeCode
impl Hash for NativeCode
Source§impl Ord for NativeCode
impl Ord for NativeCode
Source§fn cmp(&self, other: &NativeCode) -> Ordering
fn cmp(&self, other: &NativeCode) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq<NativeCode> for Physical
impl PartialEq<NativeCode> for Physical
Source§impl PartialEq<Physical> for NativeCode
impl PartialEq<Physical> for NativeCode
Source§impl PartialEq for NativeCode
impl PartialEq for NativeCode
Source§impl PartialOrd for NativeCode
impl PartialOrd for NativeCode
impl Copy for NativeCode
impl Eq for NativeCode
impl StructuralPartialEq for NativeCode
Auto Trait Implementations§
impl Freeze for NativeCode
impl RefUnwindSafe for NativeCode
impl Send for NativeCode
impl Sync for NativeCode
impl Unpin for NativeCode
impl UnwindSafe for NativeCode
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
Mutably borrows from an owned value. Read more