working structure

This commit is contained in:
2024-10-15 13:20:04 +02:00
parent eaf5828d27
commit 9e013f737f
6 changed files with 60 additions and 96 deletions
+31
View File
@@ -0,0 +1,31 @@
#[macro_export]
macro_rules! __oml {
($( ($tag:ident $($k:ident = $v:expr)*) {$($inner:tt)*} )+) => {{
let mut comps: Vec<Box<dyn Component>> = Vec::new();
$(
// comps.push(Box::new($tag(ComponentParams { children: osui::__oml!($($inner)*) })));
comps.push(oml!(($tag $($k = $v)*) {$($inner)*}));
)*
comps
}};
() => { Vec::new() };
}
#[macro_export]
macro_rules! oml {
( ($tag:ident) {} ) => {
Box::new($tag(ComponentParams { children: Vec::new() }))
};
( ($tag:ident) {$($inner:tt)*} ) => {
Box::new($tag(ComponentParams { children: osui::__oml!($($inner)*) }))
};
( ($tag:ident $($k:ident = $v:expr)+ ) {$($inner:tt)*} ) => {{
let mut c = $tag(ComponentParams { children: osui::__oml!($($inner)*) });
$(
c.$k = $v;
)+
Box::new(c)
}};
}