aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-04-16 01:02:58 -0700
committerFuwn <[email protected]>2023-04-16 01:02:58 -0700
commit4c670c427c86b8eabc488ce02b76cc9a6c9ef4fd (patch)
treecdcd7ac11e4ce74e9335fb241c961cdc3d30a365 /src
parentrefactor: make maros procedural (diff)
downloadlocus-4c670c427c86b8eabc488ce02b76cc9a6c9ef4fd.tar.xz
locus-4c670c427c86b8eabc488ce02b76cc9a6c9ef4fd.zip
refactor(macros): delete unused
Diffstat (limited to 'src')
-rw-r--r--src/macros.rs54
1 files changed, 20 insertions, 34 deletions
diff --git a/src/macros.rs b/src/macros.rs
index 4b69e9d..3d4de2e 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -58,47 +58,33 @@ 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
+ ))),
+ );
)*
};
}