[][src]Struct rmicrobit::buttons::monitors::single_with_hold::Monitor

pub struct Monitor<T: PollButton, H: HoldDescriptor> { /* fields omitted */ }

Wrapper for a single PollButton generating click and hold events.

Methods

impl<T: PollButton, H: HoldDescriptor> Monitor<T, H>[src]

pub fn new(button: T) -> Monitor<T, H>[src]

Takes ownership of a PollButton and returns a Monitor.

pub fn free(self) -> T[src]

Gives the underlying PollButton instance back.

pub fn poll(&mut self) -> Option<Event>[src]

Polls the button and filters for events.

Returns Some(Hold) if the button has been down for longer than the hold threshold.

Returns Some(Click) if the button was released (unless the monitor has already reported a 'hold' for this press).

Otherwise returns None.

The hold threshold is determined by the monitor's HoldDescriptor.

Auto Trait Implementations

impl<T, H> Unpin for Monitor<T, H> where
    T: Unpin,
    <H as HoldDescriptor>::width: Unpin

impl<T, H> Send for Monitor<T, H> where
    T: Send,
    <H as HoldDescriptor>::width: Send

impl<T, H> Sync for Monitor<T, H> where
    T: Sync,
    <H 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