serialize edn via display trait

This commit is contained in:
🪞👃🪞 2025-01-14 12:08:58 +01:00
parent 23fe9f0949
commit 08184f9906
3 changed files with 20 additions and 6 deletions

View file

@ -94,6 +94,7 @@ impl<E: Output, A: Content<E>, B: Content<E>> BspAreas<E, A, B> for Bsp<E, A, B>
impl<'a, E: Output + 'a, T: EdnViewData<'a, E>> TryFromEdn<'a, T> for Bsp<E, RenderBox<'a, E>, RenderBox<'a, E>> {
fn try_from_edn (s: &'a T, head: &EdnItem<&str>, tail: &'a [EdnItem<&str>]) -> Option<Self> {
use EdnItem::*;
panic!("({head} {} {})", tail[0], tail[1]);
Some(match (head, tail) {
(Key("bsp/n"), [a, b]) => Self::n(s.get_content(a).expect("no a"), s.get(b).expect("no b")),
(Key("bsp/s"), [a, b]) => Self::s(s.get_content(a).expect("no a"), s.get(b).expect("no b")),