pub struct KeyEvents<E, const M: usize = smart_keymap_core::::key::KeyEvents::{constant#0}>(/* private fields */);Expand description
Events emitted when a key is pressed.
Implementations§
Source§impl<E> KeyEvents<E>
impl<E> KeyEvents<E>
Sourcepub fn event(event: Event<E>) -> KeyEvents<E>
pub fn event(event: Event<E>) -> KeyEvents<E>
Constructs a KeyEvents with one same-turn Event.
Prefer this for effects that should run in the current turn
(via the event scheduler’s pending queue).
For delayed effects, use Self::schedule_event or
Self::scheduled_event with ScheduledEvent::after.
This is not the physical input delay line
(InputEventQueue one-per-tick pacing).
Sourcepub fn scheduled_event(sch_event: ScheduledEvent<E>) -> KeyEvents<E>
pub fn scheduled_event(sch_event: ScheduledEvent<E>) -> KeyEvents<E>
Constructs a KeyEvents from a single ScheduledEvent
(typically ScheduledEvent::after).
Sourcepub fn add_event(&mut self, event: Event<E>)
pub fn add_event(&mut self, event: Event<E>)
Appends a same-turn Event (see Self::event).
Sourcepub fn schedule_event(&mut self, delay: u16, event: Event<E>)
pub fn schedule_event(&mut self, delay: u16, event: Event<E>)
Appends an Event scheduled after delay ticks/ms units
(promoted on Keymap::tick, not same-turn).
Sourcepub fn map_events<F>(&self, f: fn(E) -> F) -> KeyEvents<F>
pub fn map_events<F>(&self, f: fn(E) -> F) -> KeyEvents<F>
Maps over the KeyEvents.
Sourcepub fn into_events<F>(&self) -> KeyEvents<F>where
E: Into<F>,
pub fn into_events<F>(&self) -> KeyEvents<F>where
E: Into<F>,
Maps the KeyEvents to a new type.
Trait Implementations§
Source§impl<E, const M: usize> IntoIterator for KeyEvents<E, M>where
E: Debug,
impl<E, const M: usize> IntoIterator for KeyEvents<E, M>where
E: Debug,
Source§type Item = ScheduledEvent<E>
type Item = ScheduledEvent<E>
The type of the elements being iterated over.
Source§type IntoIter = <Vec<ScheduledEvent<E>, M> as IntoIterator>::IntoIter
type IntoIter = <Vec<ScheduledEvent<E>, M> as IntoIterator>::IntoIter
Which kind of iterator are we turning this into?
Source§impl<E, const M: usize> PartialEq for KeyEvents<E, M>where
E: PartialEq,
impl<E, const M: usize> PartialEq for KeyEvents<E, M>where
E: PartialEq,
impl<E, const M: usize> Eq for KeyEvents<E, M>where
E: Eq,
impl<E, const M: usize> StructuralPartialEq for KeyEvents<E, M>
Auto Trait Implementations§
impl<E, const M: usize> Freeze for KeyEvents<E, M>where
E: Freeze,
impl<E, const M: usize> RefUnwindSafe for KeyEvents<E, M>where
E: RefUnwindSafe,
impl<E, const M: usize> Send for KeyEvents<E, M>where
E: Send,
impl<E, const M: usize> Sync for KeyEvents<E, M>where
E: Sync,
impl<E, const M: usize> Unpin for KeyEvents<E, M>where
E: Unpin,
impl<E, const M: usize> UnsafeUnpin for KeyEvents<E, M>where
E: UnsafeUnpin,
impl<E, const M: usize> UnwindSafe for KeyEvents<E, M>where
E: 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