[−][src]Struct rmicrobit::buttons::monitors::single_with_hold::Monitor
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,
T: Unpin,
<H as HoldDescriptor>::width: Unpin,
impl<T, H> Send for Monitor<T, H> where
T: Send,
<H as HoldDescriptor>::width: Send,
T: Send,
<H as HoldDescriptor>::width: Send,
impl<T, H> Sync for Monitor<T, H> where
T: Sync,
<H as HoldDescriptor>::width: Sync,
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]
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>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
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>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self