diff options
| author | Fuwn <[email protected]> | 2023-04-16 00:47:52 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-04-16 00:47:52 -0700 |
| commit | 0a0e09102f2ee86e6d7f424ad6f7048e7583f527 (patch) | |
| tree | 334eb370ff09deae2b7997592d60aab0bf6d3db9 /src | |
| parent | fix(timing): push module (what ?) (diff) | |
| download | locus-0a0e09102f2ee86e6d7f424ad6f7048e7583f527.tar.xz locus-0a0e09102f2ee86e6d7f424ad6f7048e7583f527.zip | |
refactor: make maros procedural
Diffstat (limited to 'src')
| -rw-r--r-- | src/macros.rs | 14 | ||||
| -rw-r--r-- | src/main.rs | 2 | ||||
| -rw-r--r-- | src/modules.rs | 51 |
3 files changed, 17 insertions, 50 deletions
diff --git a/src/macros.rs b/src/macros.rs index 30cb7a5..4b69e9d 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -102,17 +102,3 @@ macro_rules! batch_mount { )* }; } - -#[macro_export] -macro_rules! stateless { - ($router:ident, $module:tt) => {{ - $router.attach_stateless($module::module); - }}; -} - -#[macro_export] -macro_rules! statelesses { - ($router:ident, $($module:tt),* $(,)?) => { - $($crate::stateless!($router, $module);)* - }; -} diff --git a/src/main.rs b/src/main.rs index efbe44d..faeddcc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -84,7 +84,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { timing::time_section(&mut time_mount, "creating router"); timing::time_mounts("module", &mut time_mount, || { - stateless!(router, modules); + router.attach_stateless(modules::module); }); std::thread::spawn(modules::search::index); diff --git a/src/modules.rs b/src/modules.rs index 2d0b678..33afc88 100644 --- a/src/modules.rs +++ b/src/modules.rs @@ -16,38 +16,19 @@ // Copyright (C) 2022-2022 Fuwn <[email protected]> // SPDX-License-Identifier: GPL-3.0-only -mod blog; -mod contact; -mod interests; -mod random; -mod remarks; -// mod robots; -mod api; -mod cryptocurrency; -mod router; -pub mod search; -mod sitemap; -mod skills; -mod r#static; -mod stocks; -mod uptime; - -pub fn module(router: &mut windmark::Router) { - crate::statelesses!( - router, - uptime, - sitemap, - search, - remarks, - blog, - random, - r#static, - router, - skills, - contact, - interests, - api, - stocks, - cryptocurrency, - ); -} +amenadiel::modules!( + uptime, + sitemap, + search, + remarks, + blog, + random, + r#static, + router, + skills, + contact, + interests, + api, + stocks, + cryptocurrency +); |