Skip to main content

Classifier

Struct Classifier 

Source
struct Classifier {
    debouncer: Debouncer,
    state: State,
}
Expand description

Debounced press/hold/click state machine, polled at POLL.

Fields§

§debouncer: Debouncer

Level filter feeding the state machine.

§state: State

Current click-sequence phase.

Implementations§

Source§

impl Classifier

Source

fn new(pressed: bool) -> Self

Creates a classifier synced to the current level.

A button already held at spawn is treated as an in-progress hold with ButtonEvent::LongHold suppressed, so a reboot triggered by a held button (e.g. LongHold → Reboot) waits for the release before it accepts a new event instead of looping.

Source

fn update(&mut self, pressed: bool, now: Instant) -> Option<ButtonEvent>

Feeds one poll of the raw level (pressed = active-low reading) and returns the event that completed, if any.

Auto Trait Implementations§

§

impl Freeze for Classifier

§

impl RefUnwindSafe for Classifier

§

impl Send for Classifier

§

impl Sync for Classifier

§

impl Unpin for Classifier

§

impl UnsafeUnpin for Classifier

§

impl UnwindSafe for Classifier

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.