updated structure
This commit is contained in:
+15
-15
@@ -8,7 +8,7 @@ macro_rules! __oml {
|
||||
}};
|
||||
|
||||
($tag:ident ($($k:ident = $v:expr),*) {$($inner:tt)*} $($rest:tt)+) => {{
|
||||
let mut comps: Vec<Box<dyn osui::Component>> = osui::__oml!($($rest)+);
|
||||
let mut comps: Vec<osui::Component> = osui::__oml!($($rest)+);
|
||||
comps.insert(0, oml!($tag ($($k = $v),*) {$($inner)*}));
|
||||
comps
|
||||
}};
|
||||
@@ -19,7 +19,7 @@ macro_rules! __oml {
|
||||
}};
|
||||
|
||||
($tag:ident {$($inner:tt)*} $($rest:tt)+) => {{
|
||||
let mut comps: Vec<Box<dyn osui::Component>> = osui::__oml!($($rest)+);
|
||||
let mut comps: Vec<osui::Component> = osui::__oml!($($rest)+);
|
||||
comps.insert(0, oml!($tag {$($inner)*}));
|
||||
comps
|
||||
}};
|
||||
@@ -30,7 +30,7 @@ macro_rules! __oml {
|
||||
}};
|
||||
|
||||
($tag:ident ($expr:expr; $($k:ident = $v:expr),*) {$($inner:tt)*} $($rest:tt)+) => {{
|
||||
let mut comps: Vec<Box<dyn osui::Component>> = osui::__oml!($($rest)+);
|
||||
let mut comps: Vec<osui::Component> = osui::__oml!($($rest)+);
|
||||
comps.insert(0, oml!($tag ($expr; $($k = $v),*) {$($inner)*}));
|
||||
comps
|
||||
}};
|
||||
@@ -41,7 +41,7 @@ macro_rules! __oml {
|
||||
}};
|
||||
|
||||
($tag:ident ($expr:expr; $($k:ident = $v:expr),*) $($rest:tt)+) => {{
|
||||
let mut comps: Vec<Box<dyn osui::Component>> = osui::__oml!($($rest)+);
|
||||
let mut comps: Vec<osui::Component> = osui::__oml!($($rest)+);
|
||||
comps.insert(0, oml!($tag ($expr; $($k = $v),*)));
|
||||
comps
|
||||
}};
|
||||
@@ -52,7 +52,7 @@ macro_rules! __oml {
|
||||
}};
|
||||
|
||||
($tag:ident ($($k:ident = $v:expr),*) $($rest:tt)+) => {{
|
||||
let mut comps: Vec<Box<dyn osui::Component>> = osui::__oml!($($rest)+);
|
||||
let mut comps: Vec<osui::Component> = osui::__oml!($($rest)+);
|
||||
comps.insert(0, oml!($tag ($($k = $v),*)));
|
||||
comps
|
||||
}};
|
||||
@@ -63,7 +63,7 @@ macro_rules! __oml {
|
||||
}};
|
||||
|
||||
($expr:expr; $($rest:tt)+) => {{
|
||||
let mut comps: Vec<Box<dyn osui::Component>> = osui::__oml!($($rest)+);
|
||||
let mut comps: Vec<osui::Component> = osui::__oml!($($rest)+);
|
||||
comps.insert(0, oml!($expr));
|
||||
comps
|
||||
}};
|
||||
@@ -73,43 +73,43 @@ macro_rules! __oml {
|
||||
macro_rules! oml {
|
||||
// Props (P)
|
||||
($tag:ident ($($k:ident = $v:expr),*)) => {{
|
||||
let mut c = $tag(osui::ComponentParams { children: Vec::new(), expr: String::new() });
|
||||
let mut c = $tag(osui::Params { children: Vec::new(), expr: String::new() });
|
||||
$(
|
||||
c.$k = $v;
|
||||
)*
|
||||
Box::new(c)
|
||||
c
|
||||
}};
|
||||
|
||||
// Expression, With components (EC)
|
||||
( $tag:ident ($expr:expr; $($k:ident = $v:expr),* ) {$($inner:tt)*} ) => {{
|
||||
let mut c = $tag(osui::ComponentParams { children: osui::__oml!($($inner)*), expr: String::from($expr) });
|
||||
let mut c = $tag(osui::Params { children: osui::__oml!($($inner)*), expr: String::from($expr) });
|
||||
$(
|
||||
c.$k = $v;
|
||||
)*
|
||||
Box::new(c)
|
||||
c
|
||||
}};
|
||||
|
||||
// Expression (E)
|
||||
( $tag:ident ($expr:expr; $($k:ident = $v:expr),*) ) => {{
|
||||
let mut c = $tag(osui::ComponentParams { children: Vec::new(), expr: String::from($expr) });
|
||||
let mut c = $tag(osui::Params { children: Vec::new(), expr: String::from($expr) });
|
||||
$(
|
||||
c.$k = $v;
|
||||
)*
|
||||
Box::new(c)
|
||||
c
|
||||
}};
|
||||
|
||||
// Components (C)
|
||||
( $tag:ident {$($inner:tt)*} ) => {
|
||||
Box::new($tag(osui::ComponentParams { children: osui::__oml!($($inner)*), expr: String::new() }))
|
||||
$tag(osui::Params { children: osui::__oml!($($inner)*), expr: String::new() })
|
||||
};
|
||||
|
||||
// Props, With components (PC)
|
||||
( $tag:ident ($($k:ident = $v:expr),*) {$($inner:tt)*} ) => {{
|
||||
let mut c = $tag(osui::ComponentParams { children: osui::__oml!($($inner)*), expr: String::new() });
|
||||
let mut c = $tag(osui::Params { children: osui::__oml!($($inner)*), expr: String::new() });
|
||||
$(
|
||||
c.$k = $v;
|
||||
)*
|
||||
Box::new(c)
|
||||
c
|
||||
}};
|
||||
|
||||
// Pre-Defined (D)
|
||||
|
||||
Reference in New Issue
Block a user