once again, why did i begin to refactor this

This commit is contained in:
🪞👃🪞 2025-01-18 00:13:36 +01:00
parent 297f9b30df
commit 798de37172
15 changed files with 582 additions and 602 deletions

View file

@ -1,4 +1,5 @@
use crate::*;
use RefAtom::*;
/// Defines an enum that transforms its content
/// along either the X axis, the Y axis, or both.
///
@ -26,11 +27,10 @@ macro_rules! transform_xy {
$area
}
}
impl<'a, E: Output + 'a, T: EdnViewData<'a, E>> TryFromEdn<'a, T> for $Enum<E, RenderBox<'a, E>> {
impl<'a, E: Output + 'a, T: ViewContext<'a, E>> TryFromEdn<'a, T> for $Enum<E, RenderBox<'a, E>> {
fn try_from_edn (
state: &'a T, head: &Atom<impl AsRef<str>>, tail: &'a [Atom<impl AsRef<str>>]
state: &'a T, head: &impl Atom, tail: &'a [impl Atom]
) -> Option<Self> {
use Atom::*;
Some(match (head.to_ref(), tail) {
(Key($x), [a]) => Self::x(state.get_content(a).expect("no content")),
(Key($y), [a]) => Self::y(state.get_content(a).expect("no content")),
@ -82,11 +82,10 @@ macro_rules! transform_xy_unit {
$layout.into()
}
}
impl<'a, E: Output + 'a, T: EdnViewData<'a, E>> TryFromEdn<'a, T> for $Enum<E, E::Unit, RenderBox<'a, E>> {
impl<'a, E: Output + 'a, T: ViewContext<'a, E>> TryFromEdn<'a, T> for $Enum<E, E::Unit, RenderBox<'a, E>> {
fn try_from_edn (
state: &'a T, head: &Atom<impl AsRef<str>>, tail: &'a [Atom<impl AsRef<str>>]
state: &'a T, head: &impl Atom, tail: &'a [impl Atom]
) -> Option<Self> {
use Atom::*;
Some(match (head.to_ref(), tail) {
(Key($x), [x, a]) => Self::x(
state.get_unit(x).expect("no x"),