fix: orphaned fn
Some checks failed
/ build (push) Has been cancelled

This commit is contained in:
AAAAAAAAAAAAAAAAAAAAAAAAAAAA 2026-01-17 03:46:24 +02:00
parent 1344967f33
commit a933cbe285
4 changed files with 84 additions and 87 deletions

View file

@ -1,8 +1,4 @@
#![feature(type_changing_struct_update)]
#![feature(trait_alias)]
#[cfg(test)] mod tui_test;
mod tui_engine; pub use self::tui_engine::*;
mod tui_content; pub use self::tui_content::*;
#![feature(type_changing_struct_update, trait_alias)]
pub use ::{tengri_input, tengri_output, ratatui, crossterm, palette, better_panic};
pub(crate) use ::{
dizzle::*,
@ -25,5 +21,42 @@ pub(crate) use ::{
event::{Event, KeyEvent, KeyCode, KeyModifiers, KeyEventKind, KeyEventState},
}
};
mod tui_engine; pub use self::tui_engine::*;
mod tui_content; pub use self::tui_content::*;
#[cfg(test)] mod tui_test {
use crate::*;
#[test] fn test_tui_engine () -> Usually<()> {
//use std::sync::{Arc, RwLock};
struct TestComponent(String);
impl Content<TuiOut> for TestComponent {
fn content (&self) -> impl Draw<TuiOut> {
Some(self.0.as_str())
}
}
impl Handle<TuiIn> for TestComponent {
fn handle (&mut self, _from: &TuiIn) -> Perhaps<bool> {
Ok(None)
}
}
let engine = Tui::new()?;
engine.read().unwrap().exited.store(true, std::sync::atomic::Ordering::Relaxed);
let state = TestComponent("hello world".into());
let _state = std::sync::Arc::new(std::sync::RwLock::new(state));
//engine.run(&state)?;
Ok(())
}
//#[test] fn test_parse_key () {
////use KeyModifiers as Mods;
//let _test = |x: &str, y|assert_eq!(KeyMatcher::new(x).build(), Some(Event::Key(y)));
////test(":x",
////KeyEvent::new(KeyCode::Char('x'), Mods::NONE));
////test(":ctrl-x",
////KeyEvent::new(KeyCode::Char('x'), Mods::CONTROL));
////test(":alt-x",
////KeyEvent::new(KeyCode::Char('x'), Mods::ALT));
////test(":shift-x",
////KeyEvent::new(KeyCode::Char('x'), Mods::SHIFT));
////test(":ctrl-alt-shift-x",
////KeyEvent::new(KeyCode::Char('x'), Mods::CONTROL | Mods::ALT | Mods::SHIFT ));
//}
}