getting there with the iters but still wrong

This commit is contained in:
🪞👃🪞 2025-01-19 00:29:51 +01:00
parent 323afe4c89
commit 266f59085e
3 changed files with 32 additions and 35 deletions

View file

@ -2,7 +2,7 @@ use crate::*;
#[derive(Debug, Copy, Clone, Default)] pub enum Alignment { #[default] Center, X, Y, NW, N, NE, E, SE, S, SW, W }
pub struct Align<A>(Alignment, A);
try_from_expr!(<'a, E>: Align<RenderBox<'a, E>>: |state, iter| {
if let Some((Token { value: Value::Key(key), .. }, _)) = iter.next() {
if let Some((Token { value: Value::Key(key), .. }, iter)) = iter.next() {
match key {
"align/c" => return Some(Self::c(state.get_content(&iter.next()?.0.value).expect("no content"))),
"align/x" => return Some(Self::x(state.get_content(&iter.next()?.0.value).expect("no content"))),
@ -15,7 +15,7 @@ try_from_expr!(<'a, E>: Align<RenderBox<'a, E>>: |state, iter| {
"align/ne" => return Some(Self::ne(state.get_content(&iter.next()?.0.value).expect("no content"))),
"align/sw" => return Some(Self::sw(state.get_content(&iter.next()?.0.value).expect("no content"))),
"align/se" => return Some(Self::se(state.get_content(&iter.next()?.0.value).expect("no content"))),
_ => {}
_ => return None
}
}
});