edn stub examples are now runnable

the Render/Content trait pair is very finicky
This commit is contained in:
🪞👃🪞 2025-01-05 04:57:42 +01:00
parent f1b3fc0040
commit f6c603bf73
9 changed files with 69 additions and 56 deletions

View file

@ -11,10 +11,16 @@ fn main () -> Usually<()> {
pub struct Example;
impl EdnLayout<Tui> for Example {
impl EdnLayout<Tui> for &Example {
fn get_content <'a> (&'a self, sym: &'a str) -> Box<EdnRender<'a, Tui>> {
Box::new(Thunk::new(move||if sym == ":hello" { "Hello world!" } else { "" }))
}
}
impl Content<Tui> for Example {
fn content (&self) -> impl Render<Tui> {
EdnView::new(self, EDN).unwrap()
}
}
impl Handle<Tui> for Example {}