pub enum PhysicalKey {
Code(Code),
Unidentified(NativeKeyCode),
}Expand description
Represents the location of a physical key.
Winit will not emit KeyCode::Unidentified when it cannot recognize the key, instead it will
emit PhysicalKey::Unidentified with additional data about the key.
Variants§
Code(Code)
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 duplicate 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<PhysicalKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PhysicalKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Code> for PhysicalKey
impl From<Code> for PhysicalKey
Source§fn from(code: Code) -> PhysicalKey
fn from(code: Code) -> PhysicalKey
Converts to this type from the input type.
Source§impl From<NativeKeyCode> for PhysicalKey
impl From<NativeKeyCode> for PhysicalKey
Source§fn from(code: NativeKeyCode) -> PhysicalKey
fn from(code: NativeKeyCode) -> PhysicalKey
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<Code> for PhysicalKey
impl PartialEq<Code> for PhysicalKey
Source§impl PartialEq<NativeKeyCode> for PhysicalKey
impl PartialEq<NativeKeyCode> for PhysicalKey
Source§impl PartialEq for PhysicalKey
impl PartialEq for PhysicalKey
Source§impl PartialOrd for PhysicalKey
impl PartialOrd for PhysicalKey
Source§impl PhysicalKeyExtScancode for PhysicalKey
impl PhysicalKeyExtScancode for PhysicalKey
Source§fn to_scancode(self) -> Option<u32>
fn to_scancode(self) -> Option<u32>
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
Constructs a
PhysicalKey from a platform-specific physical key identifier. Read moreSource§impl Serialize for PhysicalKey
impl Serialize for PhysicalKey
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for PhysicalKey
impl Eq for PhysicalKey
impl StructuralPartialEq for PhysicalKey
Auto Trait Implementations§
impl Freeze for PhysicalKey
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<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
Source§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
Source§fn cast_approx(self) -> T
fn cast_approx(self) -> T
Source§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
Source§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Cast to integer, truncating Read more
Source§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Cast to the nearest integer Read more
Source§fn cast_floor(self) -> T
fn cast_floor(self) -> T
Cast the floor to an integer Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.