pub trait Button<R: ButtonRole>: Send {
// Required methods
fn wait_for_pressed<'a>(
&'a mut self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>;
fn is_pressed(&self) -> bool;
}Expand description
Async interface for waiting on a button press and querying its state.
Required Methods§
Sourcefn wait_for_pressed<'a>(
&'a mut self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>
fn wait_for_pressed<'a>( &'a mut self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>
Wait until the button transitions to the pressed state.
The returned future resolves once a debounced press is detected.
Sourcefn is_pressed(&self) -> bool
fn is_pressed(&self) -> bool
Returns true if the button is currently pressed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".