use crate::*; macro_rules! impl_content_layout_render { ($Output:ty: |$self:ident: $Struct:ty, $to:ident| layout = $layout:expr; render = $render:expr) => { impl Content<$Output> for $Struct { fn layout (&$self, $to: [u16;4]) -> [u16;4] { $layout } fn render (&$self, $to: &mut $Output) { $render } } } } mod tui_border; pub use self::tui_border::*; mod tui_button; //pub use self::tui_button::*; mod tui_color; pub use self::tui_color::*; mod tui_field; pub use self::tui_field::*; mod tui_phat; pub use self::tui_phat::*; mod tui_repeat; pub use self::tui_repeat::*; mod tui_number; //pub use self::tui_number::*; mod tui_scroll; pub use self::tui_scroll::*; mod tui_string; pub use self::tui_string::*; mod tui_style; pub use self::tui_style::*; mod tui_tryptich; pub use self::tui_tryptich::*; impl> Content for std::sync::Arc { fn layout (&self, to: [u16;4]) -> [u16;4] { Content::::layout(&**self, to) } fn render (&self, to: &mut TuiOut) { Content::::render(&**self, to) } } impl> Content for Result> { fn content (&self) -> impl Render { Bsp::a(self.as_ref().ok(), self.as_ref().err() .map(|e|Tui::fg_bg(Color::Rgb(255,255,255), Color::Rgb(32,32,32), e.to_string()))) } } //impl> Render for Result> { //fn layout (&self, to: [u16;4]) -> [u16;4] { //match self { //Ok(content) => content.layout(to), //Err(e) => [0, 0, to.w(), to.h()] //} //} //fn render (&self, to: &mut TuiOut) { //match self { //Ok(content) => content.render(to), //Err(e) => to.blit(&e.to_string(), 0, 0, Some(Style::default() //.bg(Color::Rgb(32,32,32)) //.fg(Color::Rgb(255,255,255)))) //} //} //}