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 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
impl PhysicalKeyExtScancode for PhysicalKey
source§fn from_scancode(scancode: u32) -> PhysicalKey
fn from_scancode(scancode: u32) -> PhysicalKey
Constructs a
PhysicalKey
from a platform-specific physical key identifier. Read moreimpl 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
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.