diff --git a/axum-htmx-derive/src/boosted_by/boosted_by.rs b/axum-htmx-derive/src/boosted_by/boosted_by.rs index 169625a..88b2032 100644 --- a/axum-htmx-derive/src/boosted_by/boosted_by.rs +++ b/axum-htmx-derive/src/boosted_by/boosted_by.rs @@ -73,7 +73,7 @@ pub fn transform_using_template(input: MacroInput, template_fn: ItemFn) -> ItemF // add HxBoosted input to source_fn let hx_boosted_input = template_fn.sig.inputs.first().unwrap().clone(); - source_fn.sig.inputs.push(hx_boosted_input); + source_fn.sig.inputs.insert(0, hx_boosted_input); // pop the last statement and wrap it with if-else let source_stmt = source_fn.block.stmts.pop().unwrap(); diff --git a/axum-htmx-derive/src/boosted_by/tests.rs b/axum-htmx-derive/src/boosted_by/tests.rs index 5fc5e45..0a7c839 100644 --- a/axum-htmx-derive/src/boosted_by/tests.rs +++ b/axum-htmx-derive/src/boosted_by/tests.rs @@ -17,7 +17,7 @@ fn boosted_by() { } }; let expected = quote! { - async fn index(Path(user_id): Path, axum_htmx::HxBoosted(boosted): axum_htmx::HxBoosted) -> Html { + async fn index(axum_htmx::HxBoosted(boosted): axum_htmx::HxBoosted, Path(user_id): Path) -> Html { let ctx = HomeTemplate { locale: "en".to_string(), };