mod button;
mod matrix;
mod manager;
pub mod customizable;
pub use self::button::{Button, ButtonState};
pub use self::matrix::ButtonMatrix;
pub use self::manager::DisplayManager;
use std::sync::Arc;
use tokio::sync::mpsc;
use generic_array::ArrayLength;
use crate::navigation::NavigationEntry;
#[async_trait::async_trait]
pub trait View<W, H, C, N>: Send + Sync + 'static
where
W: ArrayLength,
H: ArrayLength,
C: Send + Clone + Sync + 'static,
N: NavigationEntry<W, H, C>,
{
async fn render(&self) -> Result<ButtonMatrix<W, H>, Box<dyn std::error::Error>>
where
W: ArrayLength,
H: ArrayLength;
async fn on_click(
&self,
context: &C,
index: u8,
navigation: Arc<mpsc::Sender<N>>,
) -> Result<(), Box<dyn std::error::Error>>;
async fn fetch_all(&self, _context: &C) -> Result<(), Box<dyn std::error::Error>>;
}
pub trait ViewState: Send + Sync + 'static {
fn new() -> Self;
}