mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-02-22 10:59:02 +01:00
- output: impl Layout for Measure, FieldH, FieldV - tui: enable #[feature(trait_alias)] - tui: define some trait aliases
This commit is contained in:
parent
90fc869e14
commit
731f4a971e
13 changed files with 166 additions and 147 deletions
|
|
@ -73,12 +73,18 @@ impl Tui {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait TuiRun<R: Draw<TuiOut> + Handle<TuiIn> + 'static> {
|
||||
pub trait TuiDraw = Draw<TuiOut>;
|
||||
pub trait TuiLayout = Layout<TuiOut>;
|
||||
pub trait TuiContent = Content<TuiOut>;
|
||||
pub trait TuiHandle = Handle<TuiIn>;
|
||||
pub trait TuiWidget = TuiDraw + TuiHandle;
|
||||
|
||||
pub trait TuiRun<T: TuiWidget + 'static> {
|
||||
/// Run an app in the main loop.
|
||||
fn run (&self, state: &Arc<RwLock<R>>) -> Usually<()>;
|
||||
fn run (&self, state: &Arc<RwLock<T>>) -> Usually<()>;
|
||||
}
|
||||
|
||||
impl<T: Draw<TuiOut> + Handle<TuiIn> + Send + Sync + 'static> TuiRun<T> for Arc<RwLock<Tui>> {
|
||||
impl<T: TuiWidget + Send + Sync + 'static> TuiRun<T> for Arc<RwLock<Tui>> {
|
||||
fn run (&self, state: &Arc<RwLock<T>>) -> Usually<()> {
|
||||
let _input_thread = TuiIn::run_input(self, state, Duration::from_millis(100));
|
||||
self.write().unwrap().setup()?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue