mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
add more edn view examples
This commit is contained in:
parent
f64a9731ce
commit
a8611db452
6 changed files with 34 additions and 17 deletions
|
|
@ -10,11 +10,17 @@ pub type EdnRenderCallback<'a, O: Output, State> =
|
|||
|
||||
/// Provides values to the template
|
||||
pub trait EdnViewData<E: Output> {
|
||||
fn get_bool (&self, _sym: EdnItem<&str>) -> bool { false }
|
||||
fn get_usize (&self, _sym: EdnItem<&str>) -> usize { 0 }
|
||||
fn get_content <'a> (&'a self, _sym: EdnItem<&'a str>) -> RenderBox<'a, E> { Box::new(()) }
|
||||
fn get_bool (&self, _sym: EdnItem<&str>) -> bool {
|
||||
panic!("no content")
|
||||
}
|
||||
fn get_usize (&self, _sym: EdnItem<&str>) -> usize {
|
||||
panic!("no content")
|
||||
}
|
||||
fn get_content <'a> (&'a self, _sym: EdnItem<&'a str>) -> RenderBox<'a, E> {
|
||||
panic!("no content")
|
||||
}
|
||||
fn get_unit (&self, num: EdnItem<&str>) -> E::Unit {
|
||||
if let EdnItem::Num(n) = num { (n as u16).into() } else { 0.into() }
|
||||
if let EdnItem::Num(n) = num { (n as u16).into() } else { panic!("not a number") }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue