mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 20:26:42 +01:00
wip: more edn rendering setup
This commit is contained in:
parent
174a7ee614
commit
f1b3fc0040
10 changed files with 85 additions and 47 deletions
|
|
@ -1,8 +1,20 @@
|
|||
use tek_edn::*;
|
||||
use tek_edn::{*, tek_layout::{*, tek_engine::{*, tui::{*, TuiRun}}}};
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
const SOURCE: &'static str = include_str!("edn02.edn");
|
||||
const EDN: &'static str = include_str!("edn02.edn");
|
||||
|
||||
fn main () {
|
||||
Tui::run(Arc::new(RwLock::new(Demo::new())))?;
|
||||
fn main () -> Usually<()> {
|
||||
let state = Arc::new(RwLock::new(Example));
|
||||
Tui::new().unwrap().run(&state)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub struct 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 Handle<Tui> for Example {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue