extract tui support code to tek_tui

This commit is contained in:
🪞👃🪞 2025-01-05 10:50:32 +01:00
parent 1a9077427c
commit 1faf5bb6df
22 changed files with 477 additions and 450 deletions

View file

@ -5,8 +5,6 @@ mod engine; pub use self::engine::*;
mod input; pub use self::input::*;
mod output; pub use self::output::*;
pub mod tui;
pub use std::error::Error;
/// Standard result type.
@ -15,6 +13,16 @@ pub type Usually<T> = Result<T, Box<dyn Error>>;
/// Standard optional result type.
pub type Perhaps<T> = Result<Option<T>, Box<dyn Error>>;
/// Prototypal case of implementor macro.
/// Saves 4loc per data pats.
#[macro_export] macro_rules! from {
($(<$($lt:lifetime),+>)?|$state:ident:$Source:ty|$Target:ty=$cb:expr) => {
impl $(<$($lt),+>)? From<$Source> for $Target {
fn from ($state:$Source) -> Self { $cb }
}
};
}
#[cfg(test)] #[test] fn test_dimensions () {
assert_eq!(Area::center(&[10u16, 10, 20, 20]), [20, 20]);
}