mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 20:56:43 +01:00
ok now it fails in a different place
This commit is contained in:
parent
585bba6666
commit
23fe9f0949
9 changed files with 82 additions and 130 deletions
|
|
@ -69,77 +69,59 @@ pub trait EdnViewData<'a, E: Output>:
|
|||
EdnProvide<'a, E::Unit> +
|
||||
EdnProvide<'a, Box<dyn Render<E> + 'a>>
|
||||
{
|
||||
fn get_bool (&'a self, item: &'a EdnItem<&str>) -> bool {
|
||||
match &item {
|
||||
Num(0) => false,
|
||||
Num(_) => true,
|
||||
Sym(":true") | Sym(":t") => true,
|
||||
Sym(":false") | Sym(":f") => false,
|
||||
_ => EdnProvide::get_or_fail(self, item)
|
||||
}
|
||||
fn get_bool (&'a self, item: &'a EdnItem<&str>) -> Option<bool> {
|
||||
Some(match &item {
|
||||
Sym(":false") | Sym(":f") | Num(0) => false,
|
||||
Sym(":true") | Sym(":t") | Num(_) => true,
|
||||
_ => return EdnProvide::get(self, item)
|
||||
})
|
||||
}
|
||||
fn get_usize (&'a self, item: &'a EdnItem<&str>) -> usize {
|
||||
match &item { Num(n) => *n, _ => EdnProvide::get_or_fail(self, item) }
|
||||
fn get_usize (&'a self, item: &'a EdnItem<&str>) -> Option<usize> {
|
||||
Some(match &item { Num(n) => *n, _ => return EdnProvide::get(self, item) })
|
||||
}
|
||||
fn get_unit (&'a self, item: &'a EdnItem<&str>) -> E::Unit {
|
||||
match &item { Num(n) => (*n as u16).into(), _ => EdnProvide::get_or_fail(self, item) }
|
||||
fn get_unit (&'a self, item: &'a EdnItem<&str>) -> Option<E::Unit> {
|
||||
Some(match &item { Num(n) => (*n as u16).into(), _ => return EdnProvide::get(self, item) })
|
||||
}
|
||||
fn get_content (&'a self, item: &'a EdnItem<&'a str>) -> Box<dyn Render<E> + 'a> where E: 'a {
|
||||
match item {
|
||||
fn get_content (&'a self, item: &'a EdnItem<&'a str>) -> Option<Box<dyn Render<E> + 'a>> where E: 'a {
|
||||
Some(match item {
|
||||
Nil => Box::new(()),
|
||||
Exp(e) => if let [head, tail @ ..] = e.as_slice() {
|
||||
if let Some(builtin) = When::<_, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
return builtin.boxed()
|
||||
builtin.boxed()
|
||||
} else if let Some(builtin) = Either::<_, RenderBox<'a, E>, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
builtin.boxed()
|
||||
} else if let Some(builtin) = Align::<_, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
builtin.boxed()
|
||||
} else if let Some(builtin) = Bsp::<_, RenderBox<'a, E>, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
builtin.boxed()
|
||||
} else if let Some(builtin) = Fill::<_, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
builtin.boxed()
|
||||
} else if let Some(builtin) = Fixed::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
builtin.boxed()
|
||||
} else if let Some(builtin) = Min::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
builtin.boxed()
|
||||
} else if let Some(builtin) = Max::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
builtin.boxed()
|
||||
} else if let Some(builtin) = Shrink::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
builtin.boxed()
|
||||
} else if let Some(builtin) = Expand::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
builtin.boxed()
|
||||
} else if let Some(builtin) = Push::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
builtin.boxed()
|
||||
} else if let Some(builtin) = Pull::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
builtin.boxed()
|
||||
} else if let Some(builtin) = Margin::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
builtin.boxed()
|
||||
} else if let Some(builtin) = Padding::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
builtin.boxed()
|
||||
} else {
|
||||
EdnProvide::get_or_fail(self, &item)
|
||||
}
|
||||
if let Some(builtin) = Either::<_, RenderBox<'a, E>, RenderBox<'a, E>>::try_from_edn(
|
||||
self, head, tail
|
||||
) {
|
||||
return builtin.boxed()
|
||||
}
|
||||
if let Some(builtin) = Align::<_, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
return builtin.boxed()
|
||||
}
|
||||
if let Some(builtin) = Bsp::<_, RenderBox<'a, E>, RenderBox<'a, E>>::try_from_edn(
|
||||
self, head, tail
|
||||
) {
|
||||
return builtin.boxed()
|
||||
}
|
||||
if let Some(builtin) = Fill::<_, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
return builtin.boxed()
|
||||
}
|
||||
if let Some(builtin) = Fixed::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
return builtin.boxed()
|
||||
}
|
||||
if let Some(builtin) = Min::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
return builtin.boxed()
|
||||
}
|
||||
if let Some(builtin) = Max::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
return builtin.boxed()
|
||||
}
|
||||
if let Some(builtin) = Shrink::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
return builtin.boxed()
|
||||
}
|
||||
if let Some(builtin) = Expand::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
return builtin.boxed()
|
||||
}
|
||||
if let Some(builtin) = Push::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
return builtin.boxed()
|
||||
}
|
||||
if let Some(builtin) = Pull::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
return builtin.boxed()
|
||||
}
|
||||
if let Some(builtin) = Margin::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
return builtin.boxed()
|
||||
}
|
||||
if let Some(builtin) = Padding::<_, _, RenderBox<'a, E>>::try_from_edn(self, head, tail) {
|
||||
return builtin.boxed()
|
||||
}
|
||||
EdnProvide::get_or_fail(self, &item)
|
||||
} else {
|
||||
EdnProvide::get_or_fail(self, &item)
|
||||
},
|
||||
_ => EdnProvide::get_or_fail(self, &item)
|
||||
}
|
||||
})
|
||||
//panic!("no content")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue