mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 03:36:42 +01:00
This commit is contained in:
parent
90f5699fff
commit
f08593f0f8
5 changed files with 64 additions and 89 deletions
|
|
@ -21,6 +21,30 @@ impl<T: Content<TuiOut>> Content<TuiOut> for std::sync::Arc<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: Content<TuiOut>> Content<TuiOut> for Result<T, Box<dyn std::error::Error>> {
|
||||
fn content (&self) -> impl Render<TuiOut> {
|
||||
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<T: Render<TuiOut>> Render<TuiOut> for Result<T, Box<dyn std::error::Error>> {
|
||||
//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))))
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
|
||||
mod tui_border; pub use self::tui_border::*;
|
||||
mod tui_button; pub use self::tui_button::*;
|
||||
mod tui_color; pub use self::tui_color::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue