mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
fix passing numbers to edn view
This commit is contained in:
parent
07d90228d3
commit
f64a9731ce
4 changed files with 42 additions and 34 deletions
|
|
@ -11,9 +11,11 @@ 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_unit (&self, _sym: EdnItem<&str>) -> E::Unit { 0.into() }
|
||||
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_unit (&self, num: EdnItem<&str>) -> E::Unit {
|
||||
if let EdnItem::Num(n) = num { (n as u16).into() } else { 0.into() }
|
||||
}
|
||||
}
|
||||
|
||||
/// Renders from EDN source and context.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue