[][src]Struct rmicrobit::buttons::monitors::holding::HoldAnnotator

pub struct HoldAnnotator<T: HoldDescriptor> { /* fields omitted */ }

A hold-detection algorithm and associated state.

Methods

impl<T: HoldDescriptor> HoldAnnotator<T>[src]

pub fn new() -> HoldAnnotator<T>[src]

Returns a new HoldAnnotator.

pub fn annotate(&mut self, transition: Transition) -> Option<Event>[src]

Convert the result of a button poll to an event.

Returns events similar to those from PollButton::poll_event, but with Hold as possibility as well as Press and Release.

If the button has been down for longer than HOLD_TICKS, immediately reports Hold, and reports no event when the button is next released.

See DefaultHoldDescriptor for the default HOLD_TICKS.

Example

This example is not tested
match hold_annotator.annotate(button.poll_transition()) {
    Some(holding::Event::Press) => ...,
    Some(holding::Event::Release) => ...,
    Some(holding::Event::Hold) => ...,
    None => ...,
}

Trait Implementations

impl<T: Debug + HoldDescriptor> Debug for HoldAnnotator<T> where
    T::width: Debug
[src]

Auto Trait Implementations

impl<T> Unpin for HoldAnnotator<T> where
    <T as HoldDescriptor>::width: Unpin

impl<T> Send for HoldAnnotator<T> where
    <T as HoldDescriptor>::width: Send

impl<T> Sync for HoldAnnotator<T> where
    <T as HoldDescriptor>::width: Sync

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self