pub trait CustomButton<C>:
Send
+ 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§
Sourcefn get_state(&self) -> Button
fn get_state(&self) -> Button
Get the button state.
This method returns the current state of the button.
Sourcefn 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 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.
Sourcefn 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,
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.