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 PartialEq<NativeKey> for NativeKeyCode
impl PartialEq<NativeKey> for NativeKeyCode
source§impl PartialEq<NativeKeyCode> for NativeKey
impl PartialEq<NativeKeyCode> for NativeKey
source§impl PartialOrd for NativeKey
impl PartialOrd for NativeKey
impl Eq for NativeKey
impl StructuralPartialEq for NativeKey
Auto Trait Implementations§
impl Freeze for NativeKey
impl RefUnwindSafe for NativeKey
impl Send for NativeKey
impl Sync for NativeKey
impl Unpin for NativeKey
impl UnwindSafe for NativeKey
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.