add Layout trait

This commit is contained in:
facile pop culture reference 2026-07-07 16:35:29 +03:00
parent 1f60b43f61
commit 09463649c6
6 changed files with 208 additions and 222 deletions

View file

@ -14,23 +14,25 @@ macro_rules! eval_xy ((
Some("xy") | None => $arg2,
_ => panic!("{}: unsupported axis {variant:?}; try /x, /y, /xy", $name)
}));
match variant {
// XY variant (can be omitted)
Some("xy") | None => xy_push(
$state.namespace($arg0?)?.unwrap(),
$state.namespace($arg1?)?.unwrap(),
cb
Some("xy") | None => cb.push_xy(
$state.namespace($arg0?)?,
$state.namespace($arg1?)?,
).draw($output),
// X variant
Some("x") => x_push(
$state.namespace($arg0?)?.unwrap(),
cb
Some("x") => cb.push_x(
$state.namespace($arg0?)?,
).draw($output),
// Y variant
Some("y") => y_push(
$state.namespace($arg0?)?.unwrap(),
cb
Some("y") => cb.push_y(
$state.namespace($arg0?)?,
).draw($output),
// Other namespace members are invalid
frag => {
let name = $name;
@ -41,6 +43,7 @@ macro_rules! eval_xy ((
head.src()?.unwrap_or_default().split("/").next()
)
}
}
}});