Skip to main content

Event

Enum Event 

Source
pub enum Event<D: TimeDuration> {
    Press,
    Release {
        duration: D,
    },
    Click {
        count: u8,
    },
    Hold {
        clicks_before: u8,
        level: u8,
    },
}
Expand description

A button event produced by the state machine.

Variants§

§

Press

The button was pressed. Fires immediately on press edge.

§

Release

The button was released. duration is the total time it was held.

Fields

§duration: D
§

Click

A complete click gesture (press + release, no hold). count starts at 1. Fires once after click_timeout expires with no further press. A double-click produces a single Click { count: 2 }.

Fields

§count: u8
§

Hold

The button is being held. Fires repeatedly at a configured interval. clicks_before is the number of clicks that preceded this hold (0 = plain hold, 1 = click+hold, 2 = double-click+hold, …). level increments on each repeat (0 = first hold event, 1 = second, …).

Fields

§clicks_before: u8
§level: u8

Trait Implementations§

Source§

impl<D: Clone + TimeDuration> Clone for Event<D>

Source§

fn clone(&self) -> Event<D>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<D: Debug + TimeDuration> Debug for Event<D>

Source§

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

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

impl<D: PartialEq + TimeDuration> PartialEq for Event<D>

Source§

fn eq(&self, other: &Event<D>) -> 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<D: Copy + TimeDuration> Copy for Event<D>

Source§

impl<D: Eq + TimeDuration> Eq for Event<D>

Source§

impl<D: TimeDuration> StructuralPartialEq for Event<D>

Auto Trait Implementations§

§

impl<D> Freeze for Event<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for Event<D>
where D: RefUnwindSafe,

§

impl<D> Send for Event<D>
where D: Send,

§

impl<D> Sync for Event<D>
where D: Sync,

§

impl<D> Unpin for Event<D>
where D: Unpin,

§

impl<D> UnsafeUnpin for Event<D>
where D: UnsafeUnpin,

§

impl<D> UnwindSafe for Event<D>
where D: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.