fix missing content

This commit is contained in:
🪞👃🪞 2025-01-14 13:06:40 +01:00
parent e62e36d558
commit df50bb9f47
3 changed files with 22 additions and 10 deletions

View file

@ -95,12 +95,24 @@ impl<'a, E: Output + 'a, T: EdnViewData<'a, E>> TryFromEdn<'a, T> for Bsp<E, Ren
fn try_from_edn (s: &'a T, head: &EdnItem<&str>, tail: &'a [EdnItem<&str>]) -> Option<Self> {
use EdnItem::*;
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")),
(Key("bsp/e"), [a, b]) => Self::e(s.get_content(a).expect("no a"), s.get(b).expect("no b")),
(Key("bsp/w"), [a, b]) => Self::w(s.get_content(a).expect("no a"), s.get(b).expect("no b")),
(Key("bsp/a"), [a, b]) => Self::a(s.get_content(a).expect("no a"), s.get(b).expect("no b")),
(Key("bsp/b"), [a, b]) => Self::b(s.get_content(a).expect("no a"), s.get(b).expect("no b")),
(Key("bsp/n"), [a, b]) => Self::n(
s.get_content(a).expect("no a"),
s.get_content(b).expect("no b")),
(Key("bsp/s"), [a, b]) => Self::s(
s.get_content(a).expect("no a"),
s.get_content(b).expect("no b")),
(Key("bsp/e"), [a, b]) => Self::e(
s.get_content(a).expect("no a"),
s.get_content(b).expect("no b")),
(Key("bsp/w"), [a, b]) => Self::w(
s.get_content(a).expect("no a"),
s.get_content(b).expect("no b")),
(Key("bsp/a"), [a, b]) => Self::a(
s.get_content(a).expect("no a"),
s.get_content(b).expect("no b")),
(Key("bsp/b"), [a, b]) => Self::b(
s.get_content(a).expect("no a"),
s.get_content(b).expect("no b")),
_ => return None
})
}

View file

@ -11,9 +11,9 @@ impl<'a, E: Output + 'a, T: EdnViewData<'a, E>> TryFromEdn<'a, T> for Either<E,
use EdnItem::*;
if let (Key("either"), [condition, content, alternative]) = (head, tail) {
Some(Self::new(
state.get(condition).expect("either: no condition"),
state.get(content).expect("either: no content"),
state.get(alternative).expect("either: no alternative")
state.get_bool(condition).expect("either: no condition"),
state.get_content(content).expect("either: no content"),
state.get_content(alternative).expect("either: no alternative")
))
} else {
None