pub struct PressedKey<K, S> {
pub keymap_index: u16,
pub key: K,
pub pressed_key_state: S,
}
Expand description
A struct for associating a crate::key::Key with a crate::key::PressedKeyState.
Fields§
§keymap_index: u16
The index of the pressed key in some keymap.
key: K
The pressed key.
pressed_key_state: S
The pressed key state.
Implementations§
Source§impl<K, S> PressedKey<K, S>
impl<K, S> PressedKey<K, S>
Sourcepub fn map_pressed_key<IK, IS>(
self,
f_k: fn(_: K) -> IK,
f_s: fn(_: S) -> IS,
) -> PressedKey<IK, IS>
pub fn map_pressed_key<IK, IS>( self, f_k: fn(_: K) -> IK, f_s: fn(_: S) -> IS, ) -> PressedKey<IK, IS>
Maps the key and pressed key state of the PressedKey to a new type.
Sourcepub fn into_pressed_key<IK, IS>(self) -> PressedKey<IK, IS>
pub fn into_pressed_key<IK, IS>(self) -> PressedKey<IK, IS>
Transforms the PressedKey to a new type.
Trait Implementations§
Source§impl<K: Clone, S: Clone> Clone for PressedKey<K, S>
impl<K: Clone, S: Clone> Clone for PressedKey<K, S>
Source§fn clone(&self) -> PressedKey<K, S>
fn clone(&self) -> PressedKey<K, S>
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<K: Key, S: PressedKeyState<K, Context = K::Context, Event = K::Event>> PressedKey for PressedKey<K, S>
impl<K: Key, S: PressedKeyState<K, Context = K::Context, Event = K::Event>> PressedKey for PressedKey<K, S>
Source§fn handle_event(
&mut self,
context: Self::Context,
event: Event<Self::Event>,
) -> PressedKeyEvents<Self::Event>
fn handle_event( &mut self, context: Self::Context, event: Event<Self::Event>, ) -> PressedKeyEvents<Self::Event>
Used to update the PressedKey’s state, and possibly yield event(s).
Source§fn key_output(&self) -> KeyOutputState
fn key_output(&self) -> KeyOutputState
Output for the pressed key.
impl<K: Copy, S: Copy> Copy for PressedKey<K, S>
impl<K, S> StructuralPartialEq for PressedKey<K, S>
Auto Trait Implementations§
impl<K, S> Freeze for PressedKey<K, S>
impl<K, S> RefUnwindSafe for PressedKey<K, S>where
K: RefUnwindSafe,
S: RefUnwindSafe,
impl<K, S> Send for PressedKey<K, S>
impl<K, S> Sync for PressedKey<K, S>
impl<K, S> Unpin for PressedKey<K, S>
impl<K, S> UnwindSafe for PressedKey<K, S>where
K: UnwindSafe,
S: UnwindSafe,
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