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

pub struct Monitor<A: PollButton, B: PollButton> { /* fields omitted */ }

Wrapper for two PollButtons generating click events on release.

The buttons don't have to be the micro:bit's built-in buttons, though the generated Events include 'A' and 'B' in their names.

Methods

impl<A: PollButton, B: PollButton> Monitor<A, B>[src]

pub fn new(button_a: A, button_b: B) -> Monitor<A, B>[src]

Takes ownership of two PollButtons and returns a Monitor.

pub fn free(self) -> (A, B)[src]

Gives the underlying PollButton instances back.

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

Polls both buttons and filters for events.

If both buttons have been pressed, returns Some(ClickAB) when the second one is released.

Otherwise, returns Some(ClickA) if the first button was released or Some(ClickB) if the second button was released.

Otherwise returns None.

Auto Trait Implementations

impl<A, B> Unpin for Monitor<A, B> where
    A: Unpin,
    B: Unpin

impl<A, B> Send for Monitor<A, B> where
    A: Send,
    B: Send

impl<A, B> Sync for Monitor<A, B> where
    A: Sync,
    B: 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