diff --git a/core/src/lib.rs b/core/src/lib.rs index f3cf313..22288d1 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -5,17 +5,3 @@ pub type Usually = Result>; /// Standard optional result type. pub type Perhaps = Result, Box>; - -/// Implement the `From` trait. -#[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 } - } - }; -} - -pub trait Has: Send + Sync { - fn get (&self) -> &T; - fn get_mut (&mut self) -> &mut T; -} diff --git a/output/src/space/measure.rs b/output/src/space/measure.rs index 9ea4765..2a1e415 100644 --- a/output/src/space/measure.rs +++ b/output/src/space/measure.rs @@ -3,17 +3,13 @@ use std::sync::{Arc, atomic::{AtomicUsize, Ordering::Relaxed}}; pub trait HasSize { fn size (&self) -> &Measure; - fn width (&self) -> usize { - self.size().w() - } - fn height (&self) -> usize { - self.size().w() - } } -impl>> HasSize for T { - fn size (&self) -> &Measure { - self.get() +#[macro_export] macro_rules! has_size { + (<$E:ty>|$self:ident:$Struct:ident$(<$($L:lifetime),*$($T:ident$(:$U:path)?),*>)?|$cb:expr) => { + impl $(<$($L),*$($T $(: $U)?),*>)? HasSize<$E> for $Struct $(<$($L),*$($T),*>)? { + fn size (&$self) -> &Measure<$E> { $cb } + } } } diff --git a/proc/src/proc_command.rs b/proc/src/proc_command.rs index f8e9d2a..bfe9246 100644 --- a/proc/src/proc_command.rs +++ b/proc/src/proc_command.rs @@ -82,7 +82,6 @@ impl ToTokens for CommandDef { fn get <'source> (&self, iter: &mut ::tengri::dsl::TokenIter<'source>) -> Option<#enumeration> { - use ::tengri::dsl::TryFromDsl; #enumeration::try_from_expr(self, iter) } } diff --git a/tui/src/lib.rs b/tui/src/lib.rs index 79648b9..01eb7d9 100644 --- a/tui/src/lib.rs +++ b/tui/src/lib.rs @@ -33,6 +33,16 @@ pub use ::ratatui; pub(crate) use ratatui::{ pub(crate) use std::sync::{Arc, RwLock, atomic::{AtomicBool, Ordering::*}}; pub(crate) use std::io::{stdout, Stdout}; +pub(crate) use std::path::PathBuf; +pub(crate) use std::ffi::OsString; + +#[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_tui_engine () -> Usually<()> { use crate::*;