diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/macros.rs | 9 | ||||
| -rw-r--r-- | src/main.rs | 42 |
2 files changed, 30 insertions, 21 deletions
diff --git a/src/macros.rs b/src/macros.rs index 47a85cb..7d7761f 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -82,3 +82,12 @@ macro_rules! mount_file { ); }; } + +#[macro_export] +macro_rules! batch_mount_file { + ($router:ident,$(($path:literal, $description:literal, $file:literal),)*) => { + $( + mount_page!($router, $path, $description, $file); + )* + }; +} diff --git a/src/main.rs b/src/main.rs index 9abb28c..4d7e781 100644 --- a/src/main.rs +++ b/src/main.rs @@ -166,28 +166,28 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { "This Gemini capsule's icon", "favicon.txt" ); - mount_page!(router, "/", "This Gemini capsule's homepage", "index"); - mount_page!(router, "/contact", "Many ways to contact Fuwn", "contact"); - mount_page!(router, "/donate", "Many ways to donate to Fuwn", "donate"); - mount_page!( + batch_mount_file!( router, - "/gemini", - "Information and resources for the Gemini protocol", - "gemini" - ); - mount_page!( - router, - "/gopher", - "Information and resources for the Gopher protocol", - "gopher" - ); - mount_page!(router, "/interests", "A few interests of Fuwn", "interests"); - mount_page!(router, "/skills", "A few skills of Fuwn", "skills"); - mount_page!( - router, - "/licensing", - "The licensing terms of this Gemini capsule", - "licensing" + ("/", "This Gemini capsule's homepage", "index"), + ("/contact", "Many ways to contact Fuwn", "contact"), + ("/donate", "Many ways to donate to Fuwn", "donate"), + ( + "/gemini", + "Information and resources for the Gemini protocol", + "gemini" + ), + ( + "/gopher", + "Information and resources for the Gopher protocol", + "gopher" + ), + ("/interests", "A few interests of Fuwn", "interests"), + ("/skills", "A few skills of Fuwn", "skills"), + ( + "/licensing", + "The licensing terms of this Gemini capsule", + "licensing" + ), ); }); |