mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
and it once again compiles
This commit is contained in:
parent
6dd4caeb42
commit
430c51e305
31 changed files with 466 additions and 694 deletions
|
|
@ -2,7 +2,7 @@ pub use ratatui;
|
|||
pub use crossterm;
|
||||
pub use midly;
|
||||
pub use clap;
|
||||
pub use std::sync::{Arc, Mutex, RwLock};
|
||||
pub use std::sync::{Arc, Mutex, RwLock, RwLockReadGuard, RwLockWriteGuard};
|
||||
pub use std::collections::BTreeMap;
|
||||
pub use crossterm::event::{Event, KeyEvent, KeyCode, KeyModifiers};
|
||||
pub use ratatui::prelude::{Rect, Style, Color, Buffer};
|
||||
|
|
@ -67,9 +67,18 @@ pub trait Component: Render + Handle + Sync {
|
|||
}
|
||||
}
|
||||
|
||||
/// Anything that implements `Render` + `Handle` can be used as a UI component.
|
||||
impl<T: Render + Handle + Sync> Component for T {}
|
||||
|
||||
/// Marker trait for [Component]s that can [Exit]
|
||||
pub trait ExitableComponent: Exit + Component {
|
||||
/// Perform type erasure for collecting heterogeneous components.
|
||||
fn boxed (self) -> Box<dyn ExitableComponent> where Self: Sized + 'static {
|
||||
Box::new(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Exit + Component> ExitableComponent for T {}
|
||||
|
||||
/// Run the main loop.
|
||||
pub fn run <T> (state: Arc<RwLock<T>>) -> Usually<Arc<RwLock<T>>>
|
||||
where T: Render + Handle + Send + Sync + Sized + 'static
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue