Skip to main content

Strategy

Trait Strategy 

Source
pub trait Strategy {
    // Required methods
    fn status(&self) -> Option<Status>;
    fn update(&self, status: Status) -> Option<Status>;
}
Expand description

§Defining the Debouncing Algorithm

The strategy needs to do everything to debounce the input, but it should not store the most recent state.

Required Methods§

Source

fn status(&self) -> Option<Status>

The current status of the debouncing.

If the debouncer isn’t confident that the input is stable, returns None.

If the debouncer thinks the input is stable, returns Some(...) of the stable value.

Source

fn update(&self, status: Status) -> Option<Status>

Updates the debouncer algorithm with the latest status.

Returns Strategy::status.

Implementors§