Enum winit::keyboard::PhysicalKey
source · pub enum PhysicalKey {
Code(KeyCode),
Unidentified(NativeKeyCode),
}
Expand description
Represents the location of a physical key.
This type is a superset of KeyCode
, including an Unidentified
variant.
Variants§
Code(KeyCode)
A known key code
Unidentified(NativeKeyCode)
This variant is used when the key cannot be translated to a KeyCode
The native keycode is provided (if available) so you’re able to more reliably match
key-press and key-release events by hashing the PhysicalKey
. It is also possible to use
this for keybinds for non-standard keys, but such keybinds are tied to a given platform.
Trait Implementations§
source§impl Clone for PhysicalKey
impl Clone for PhysicalKey
source§fn clone(&self) -> PhysicalKey
fn clone(&self) -> PhysicalKey
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 PhysicalKey
impl Debug for PhysicalKey
source§impl<'de> Deserialize<'de> for PhysicalKey
impl<'de> Deserialize<'de> for PhysicalKey
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<KeyCode> for PhysicalKey
impl From<KeyCode> for PhysicalKey
source§impl From<NativeKeyCode> for PhysicalKey
impl From<NativeKeyCode> for PhysicalKey
source§fn from(code: NativeKeyCode) -> Self
fn from(code: NativeKeyCode) -> Self
Converts to this type from the input type.
source§impl Hash for PhysicalKey
impl Hash for PhysicalKey
source§impl Ord for PhysicalKey
impl Ord for PhysicalKey
source§fn cmp(&self, other: &PhysicalKey) -> Ordering
fn cmp(&self, other: &PhysicalKey) -> 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<KeyCode> for PhysicalKey
impl PartialEq<KeyCode> for PhysicalKey
source§impl PartialEq<NativeKeyCode> for PhysicalKey
impl PartialEq<NativeKeyCode> for PhysicalKey
source§fn eq(&self, rhs: &NativeKeyCode) -> bool
fn eq(&self, rhs: &NativeKeyCode) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<PhysicalKey> for KeyCode
impl PartialEq<PhysicalKey> for KeyCode
source§fn eq(&self, rhs: &PhysicalKey) -> bool
fn eq(&self, rhs: &PhysicalKey) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<PhysicalKey> for NativeKeyCode
impl PartialEq<PhysicalKey> for NativeKeyCode
source§fn eq(&self, rhs: &PhysicalKey) -> bool
fn eq(&self, rhs: &PhysicalKey) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq for PhysicalKey
impl PartialEq for PhysicalKey
source§fn eq(&self, other: &PhysicalKey) -> bool
fn eq(&self, other: &PhysicalKey) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for PhysicalKey
impl PartialOrd for PhysicalKey
source§fn partial_cmp(&self, other: &PhysicalKey) -> Option<Ordering>
fn partial_cmp(&self, other: &PhysicalKey) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl PhysicalKeyExtScancode for PhysicalKey
Available on macos_platform
only.
impl PhysicalKeyExtScancode for PhysicalKey
Available on
macos_platform
only.source§fn to_scancode(self) -> Option<u32>
fn to_scancode(self) -> Option<u32>
Available on
windows_platform
or macos_platform
or x11_platform
or wayland_platform
only.The raw value of the platform-specific physical key identifier. Read more
source§fn from_scancode(scancode: u32) -> PhysicalKey
fn from_scancode(scancode: u32) -> PhysicalKey
Available on
windows_platform
or macos_platform
or x11_platform
or wayland_platform
only.Constructs a
PhysicalKey
from a platform-specific physical key identifier. Read moresource§impl Serialize for PhysicalKey
impl Serialize for PhysicalKey
impl Copy for PhysicalKey
impl Eq for PhysicalKey
impl StructuralEq for PhysicalKey
impl StructuralPartialEq for PhysicalKey
Auto Trait Implementations§
impl RefUnwindSafe for PhysicalKey
impl Send for PhysicalKey
impl Sync for PhysicalKey
impl Unpin 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
Mutably borrows from an owned value. Read more