positional async

This commit is contained in:
2024-12-24 20:59:58 +01:00
parent 7e2106cae5
commit fde1eed352
2 changed files with 8 additions and 2 deletions
+5
View File
@@ -319,6 +319,11 @@ impl Children {
0 0
} }
} }
pub fn insert(&mut self, index: usize, element: Element) {
if let Children::Children(children, _) = self {
children.insert(index, element);
}
}
} }
impl<T> Handler<T> { impl<T> Handler<T> {
+3 -2
View File
@@ -13,9 +13,10 @@ macro_rules! check_expr {
#[macro_export] #[macro_export]
macro_rules! parse_rsx_param { macro_rules! parse_rsx_param {
($elem:expr, async $code:block $($rest:tt)*) => { ($elem:expr, async $code:block $($rest:tt)*) => {
let elem_len = $elem.children.len();
$elem.instructions.push($crate::Instruction::Load(Handler::new( $elem.instructions.push($crate::Instruction::Load(Handler::new(
|d: &mut Div, _, _| { move |d: &mut Div, _, _| {
d.children.add_child($code); d.children.insert(elem_len, $code);
} }
))); )));
osui::parse_rsx_param!($elem, $($rest)*); osui::parse_rsx_param!($elem, $($rest)*);