From 4c670c427c86b8eabc488ce02b76cc9a6c9ef4fd Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 16 Apr 2023 01:02:58 -0700 Subject: refactor(macros): delete unused --- src/macros.rs | 54 ++++++++++++++++++++---------------------------------- 1 file changed, 20 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/macros.rs b/src/macros.rs index 4b69e9d..3d4de2e 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -57,48 +57,34 @@ macro_rules! success { }}; } -#[macro_export] -macro_rules! mount_page { - ($router:ident, $at:literal, $description:literal, $file:literal) => { - (*$crate::route::ROUTES.lock().unwrap()) - .insert($at.to_string(), $crate::route::Route::new($description)); - - ($router).mount($at, |context: ::windmark::context::RouteContext| { - let content = - include_str!(concat!("../../content/static/", $file, ".gmi")); - - $crate::route::cache(&context, &content); - $crate::success!(content, context) - }); - }; -} - -#[macro_export] -macro_rules! mount_file { - ($router:ident, $at:literal, $description:literal, $file:literal) => { - (*$crate::route::ROUTES.lock().unwrap()) - .insert($at.to_string(), $crate::route::Route::new($description)); - - ($router).mount( - $at, - ::windmark::binary_success_auto!(include_bytes!(concat!( - "../../content/meta/", - $file - ))), - ); - }; -} - #[macro_export] macro_rules! batch_mount { ("pages", $router:ident, $(($path:literal, $description:literal, $file:literal)),* $(,)?) => { $( - $crate::mount_page!($router, $path, $description, $file); + (*$crate::route::ROUTES.lock().unwrap()) + .insert($path.to_string(), $crate::route::Route::new($description)); + + ($router).mount($path, |context: ::windmark::context::RouteContext| { + let content = + include_str!(concat!("../../content/static/", $file, ".gmi")); + + $crate::route::cache(&context, &content); + $crate::success!(content, context) + }); )* }; ("files", $router:ident, $(($path:literal, $description:literal, $file:literal)),* $(,)?) => { $( - $crate::mount_file!($router, $path, $description, $file); + (*$crate::route::ROUTES.lock().unwrap()) + .insert($path.to_string(), $crate::route::Route::new($description)); + + ($router).mount( + $path, + ::windmark::binary_success_auto!(include_bytes!(concat!( + "../../content/meta/", + $file + ))), + ); )* }; } -- cgit v1.2.3