smart_keymap::key

Struct PressedKeyEvents

Source
pub struct PressedKeyEvents<E, const M: usize = { MAX_KEY_EVENTS }>(/* private fields */);
Expand description

Events emitted when a Key is pressed.

Implementations§

Source§

impl<E: Copy + Debug> PressedKeyEvents<E>

Source

pub fn no_events() -> Self

Constructs a PressedKeyEvents with no events scheduled.

Source

pub fn event(event: Event<E>) -> Self

Constructs a PressedKeyEvents with an immediate Event.

Source

pub fn scheduled_event(sch_event: ScheduledEvent<E>) -> Self

Constructs a PressedKeyEvents with an Event scheduled after a delay.

Source

pub fn schedule_event(&mut self, delay: u16, event: Event<E>)

Adds an event with the schedule to the PressedKeyEvents.

Source

pub fn extend(&mut self, other: PressedKeyEvents<E>)

Adds events from the other PressedKeyEvents to the PressedKeyEvents.

Source

pub fn add_event(&mut self, ev: ScheduledEvent<E>)

Adds an event from to the PressedKeyEvents.

Source

pub fn map_events<F>(&self, f: fn(_: E) -> F) -> PressedKeyEvents<F>

Maps over the PressedKeyEvents.

Source

pub fn into_events<F>(&self) -> PressedKeyEvents<F>
where E: Into<F>,

Maps the PressedKeyEvents to a new type.

Trait Implementations§

Source§

impl<E: Debug, const M: usize> Debug for PressedKeyEvents<E, M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E: Debug, const M: usize> IntoIterator for PressedKeyEvents<E, M>

Source§

type Item = ScheduledEvent<E>

The type of the elements being iterated over.
Source§

type IntoIter = <Vec<ScheduledEvent<E>, M> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<E: PartialEq, const M: usize> PartialEq for PressedKeyEvents<E, M>

Source§

fn eq(&self, other: &PressedKeyEvents<E, M>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<E: Eq, const M: usize> Eq for PressedKeyEvents<E, M>

Source§

impl<E, const M: usize> StructuralPartialEq for PressedKeyEvents<E, M>

Auto Trait Implementations§

§

impl<E, const M: usize> Freeze for PressedKeyEvents<E, M>
where E: Freeze,

§

impl<E, const M: usize> RefUnwindSafe for PressedKeyEvents<E, M>
where E: RefUnwindSafe,

§

impl<E, const M: usize> Send for PressedKeyEvents<E, M>
where E: Send,

§

impl<E, const M: usize> Sync for PressedKeyEvents<E, M>
where E: Sync,

§

impl<E, const M: usize> Unpin for PressedKeyEvents<E, M>
where E: Unpin,

§

impl<E, const M: usize> UnwindSafe for PressedKeyEvents<E, M>
where E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.