Enum kas::event::PhysicalKey
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§
§impl Clone for PhysicalKey
impl Clone for PhysicalKey
§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 more§impl Debug for PhysicalKey
impl Debug for PhysicalKey
§impl From<KeyCode> for PhysicalKey
impl From<KeyCode> for PhysicalKey
§fn from(code: KeyCode) -> PhysicalKey
fn from(code: KeyCode) -> PhysicalKey
Converts to this type from the input type.
§impl From<NativeKeyCode> for PhysicalKey
impl From<NativeKeyCode> for PhysicalKey
§fn from(code: NativeKeyCode) -> PhysicalKey
fn from(code: NativeKeyCode) -> PhysicalKey
Converts to this type from the input type.
§impl Hash for PhysicalKey
impl Hash for PhysicalKey
§impl Ord for PhysicalKey
impl Ord for PhysicalKey
§impl PartialEq<KeyCode> for PhysicalKey
impl PartialEq<KeyCode> for PhysicalKey
§impl PartialEq<NativeKeyCode> for PhysicalKey
impl PartialEq<NativeKeyCode> for PhysicalKey
§impl PartialEq for PhysicalKey
impl PartialEq for PhysicalKey
§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 ==
.§impl PartialOrd for PhysicalKey
impl PartialOrd for PhysicalKey
§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 more§impl PhysicalKeyExtScancode for PhysicalKey
impl PhysicalKeyExtScancode for PhysicalKey
§fn to_scancode(self) -> Option<u32>
fn to_scancode(self) -> Option<u32>
The raw value of the platform-specific physical key identifier. Read more
§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
§impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
§fn cast_approx(self) -> T
fn cast_approx(self) -> T
§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Cast to integer, truncating Read more
§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Cast to the nearest integer Read more
§fn cast_floor(self) -> T
fn cast_floor(self) -> T
Cast the floor to an integer Read more
§fn try_cast_trunc(self) -> Result<T, Error>
fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
§fn try_cast_nearest(self) -> Result<T, Error>
fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
§fn try_cast_floor(self) -> Result<T, Error>
fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
§fn try_cast_ceil(self) -> Result<T, Error>
fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.