Trait CustomButton

Source
pub trait CustomButton<C>:
    Send
    + Sync
    + 'static
where C: Send + Clone + Sync + 'static,
{ // Required methods fn get_state(&self) -> Button; fn fetch<'life0, 'life1, 'async_trait>( &'life0 self, context: &'life1 C, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn click<'life0, 'life1, 'async_trait>( &'life0 self, context: &'life1 C, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; }
Expand description

A trait for custom buttons.

This trait is implemented by types that represent custom buttons in a customizable view. It provides methods for getting the button state, fetching state, and handling clicks.

Required Methods§

Source

fn get_state(&self) -> Button

Get the button state.

This method returns the current state of the button.

Source

fn fetch<'life0, 'life1, 'async_trait>( &'life0 self, context: &'life1 C, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch state for the button.

This method fetches the state for the button. It takes the application context.

Source

fn click<'life0, 'life1, 'async_trait>( &'life0 self, context: &'life1 C, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle a button click.

This method is called when the button is clicked. It takes the application context.

Implementors§

Source§

impl<C> CustomButton<C> for ClickButton<C>
where C: Send + Clone + Sync + 'static,

Source§

impl<C> CustomButton<C> for ToggleButton<C>
where C: Send + Clone + Sync + 'static,