pub trait View<W, H, C, N>:
Send
+ Sync
+ 'staticwhere
W: ArrayLength,
H: ArrayLength,
C: Send + Clone + Sync + 'static,
N: NavigationEntry<W, H, C>,{
// Required methods
fn render<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ButtonMatrix<W, H>, Box<dyn Error>>> + Send + 'async_trait>>
where W: ArrayLength,
H: ArrayLength,
Self: 'async_trait,
'life0: 'async_trait;
fn on_click<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 C,
index: u8,
navigation: Arc<Sender<N>>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn fetch_all<'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 views in a Stream Deck application.
This trait is implemented by types that represent different views or screens in a Stream Deck application. It provides methods for rendering the view, handling button clicks, and fetching state.
Required Methods§
Sourcefn render<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ButtonMatrix<W, H>, Box<dyn Error>>> + Send + 'async_trait>>where
W: ArrayLength,
H: ArrayLength,
Self: 'async_trait,
'life0: 'async_trait,
fn render<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ButtonMatrix<W, H>, Box<dyn Error>>> + Send + 'async_trait>>where
W: ArrayLength,
H: ArrayLength,
Self: 'async_trait,
'life0: 'async_trait,
Render the view to a button matrix.
This method returns a button matrix that can be used to render the buttons for this view.
Sourcefn on_click<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 C,
index: u8,
navigation: Arc<Sender<N>>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_click<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 C,
index: u8,
navigation: Arc<Sender<N>>,
) -> 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 a button is clicked. It takes the application context, the button index, and a sender for navigation events.
Sourcefn fetch_all<'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_all<'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 all buttons in the view.
This method is called to fetch the state for all buttons in the view. It takes the application context.