Compare commits

..

No commits in common. "8bfd1a23a1f880a1d2fb104a158fc51f244acd6e" and "bad20f5037dc22d572a8381840fab871ce65f565" have entirely different histories.

4 changed files with 15 additions and 24 deletions

View file

@ -5,17 +5,3 @@ pub type Usually<T> = Result<T, Box<dyn Error>>;
/// Standard optional result type.
pub type Perhaps<T> = Result<Option<T>, Box<dyn Error>>;
/// 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<T>: Send + Sync {
fn get (&self) -> &T;
fn get_mut (&mut self) -> &mut T;
}

View file

@ -3,17 +3,13 @@ use std::sync::{Arc, atomic::{AtomicUsize, Ordering::Relaxed}};
pub trait HasSize<E: Output> {
fn size (&self) -> &Measure<E>;
fn width (&self) -> usize {
self.size().w()
}
fn height (&self) -> usize {
self.size().w()
}
}
impl<E: Output, T: Has<Measure<E>>> HasSize<E> for T {
fn size (&self) -> &Measure<E> {
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 }
}
}
}

View file

@ -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)
}
}

View file

@ -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::*;