aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-04-16 21:15:12 -0700
committerFuwn <[email protected]>2023-04-16 21:15:12 -0700
commitc7adc5f014d4635c8468a863a124ddce4a9fe0e7 (patch)
tree2f5a8aafdbf3fa0712d01ecb95ccd10eb691fd10 /src/modules
parentfix(amenadiel): modules macro unwrap on none (diff)
downloadlocus-c7adc5f014d4635c8468a863a124ddce4a9fe0e7.tar.xz
locus-c7adc5f014d4635c8468a863a124ddce4a9fe0e7.zip
refactor(response): rewrite unnecessary macro to function
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/blog/module.rs12
-rw-r--r--src/modules/contact.rs2
-rw-r--r--src/modules/cryptocurrency.rs14
-rw-r--r--src/modules/interests.rs6
-rw-r--r--src/modules/remarks.rs6
-rw-r--r--src/modules/search.rs2
-rw-r--r--src/modules/sitemap.rs6
-rw-r--r--src/modules/skills.rs2
-rw-r--r--src/modules/stocks.rs20
9 files changed, 35 insertions, 35 deletions
diff --git a/src/modules/blog/module.rs b/src/modules/blog/module.rs
index a5cbcba..433a1f5 100644
--- a/src/modules/blog/module.rs
+++ b/src/modules/blog/module.rs
@@ -25,7 +25,7 @@ use std::{
use crate::{
modules::blog::config::Blog,
route::track_mount,
- success,
+ response::success,
xml::{Item as XmlItem, Writer as XmlWriter},
};
@@ -101,7 +101,7 @@ pub fn module(router: &mut windmark::Router) {
let blog_clone = blogs.clone();
track_mount(router, "/blog", "Fuwn's blogs", move |context| {
- success!(
+ success(
&format!(
"# Blogs ({})\n\n{}",
blog_clone.len(),
@@ -137,7 +137,7 @@ pub fn module(router: &mut windmark::Router) {
.collect::<Vec<_>>()
.join("\n")
),
- context
+ &context
)
});
@@ -182,7 +182,7 @@ pub fn module(router: &mut windmark::Router) {
move |context| {
let fixed_blog_name = fixed_blog_name_clone.clone();
- success!(
+ success(
&format!(
"# {} ({})\n\n{}\n\n{}\n\n## Really Simple Syndication\n\nAccess \
{0}'s RSS feed\n\n=> {} here!",
@@ -229,7 +229,7 @@ pub fn module(router: &mut windmark::Router) {
.join("\n"),
format_args!("/blog/{}.xml", fixed_blog_name),
),
- context
+ &context
)
},
);
@@ -290,7 +290,7 @@ pub fn module(router: &mut windmark::Router) {
}
),
move |context| {
- success!(format!("{}\n{}", header.0, contents,), context)
+ success(&format!("{}\n{}", header.0, contents,), &context)
},
);
}
diff --git a/src/modules/contact.rs b/src/modules/contact.rs
index f82922e..76781b9 100644
--- a/src/modules/contact.rs
+++ b/src/modules/contact.rs
@@ -51,7 +51,7 @@ pub fn module(router: &mut windmark::Router) {
"/contact",
"A Few Skills of Fuwn",
move |context| {
- crate::success!(format!("# Contact\n\n{}", contacts.join("\n")), context)
+ crate::response::success(&format!("# Contact\n\n{}", contacts.join("\n")), &context)
},
);
}
diff --git a/src/modules/cryptocurrency.rs b/src/modules/cryptocurrency.rs
index 752c251..87f6ca0 100644
--- a/src/modules/cryptocurrency.rs
+++ b/src/modules/cryptocurrency.rs
@@ -19,7 +19,7 @@
use once_cell::sync::Lazy;
use serde::Deserialize;
-use crate::{route::track_mount, success};
+use crate::{route::track_mount, response::success};
static REFERRALS: Lazy<Vec<Referral>> = Lazy::new(|| {
serde_json::from_str(include_str!(
@@ -42,8 +42,8 @@ pub fn module(router: &mut windmark::Router) {
"Want to start investing in cryptocurrency? Support me by using one of my \
referral links!",
|context| {
- success!(
- format!(
+ success(
+ &format!(
"# Referrals\n\n=> /cryptocurrency Home\n=> /stocks Stock Market \
Dashboard\n\nWant to start investing? Support me by using one of \
my referral links!\n\n{}",
@@ -55,7 +55,7 @@ pub fn module(router: &mut windmark::Router) {
.collect::<Vec<String>>()
.join("\n")
),
- context
+ &context
)
},
);
@@ -65,12 +65,12 @@ pub fn module(router: &mut windmark::Router) {
"/cryptocurrency",
"Relevant information regarding cryptocurrency investing",
|context| {
- success!(
- format!(
+ success(
+ &format!(
"# Cryptocurrency\n\n=> /stocks Stock Market Dashboard\n=> \
/cryptocurrency/referrals Referrals",
),
- context
+ &context
)
},
);
diff --git a/src/modules/interests.rs b/src/modules/interests.rs
index 6762e55..90d96eb 100644
--- a/src/modules/interests.rs
+++ b/src/modules/interests.rs
@@ -51,13 +51,13 @@ pub fn module(router: &mut windmark::Router) {
"/interests",
"A Few Interests of Fuwn",
move |context| {
- crate::success!(
- format!(
+ crate::response::success(
+ &format!(
"# Interests\n\nA collection of things that I think are pretty neat \
and I am considering using more in the future.\n\n{}",
contacts.join("\n")
),
- context
+ &context
)
},
);
diff --git a/src/modules/remarks.rs b/src/modules/remarks.rs
index 29ad684..0b5fc26 100644
--- a/src/modules/remarks.rs
+++ b/src/modules/remarks.rs
@@ -37,8 +37,8 @@ pub fn module(router: &mut windmark::Router) {
"Fuwn's thoughts which are too short to be their own blog; but just long \
enough to be a remark.",
|context| {
- crate::success!(
- format!(
+ crate::response::success(
+ &format!(
"# Remarks\n\nFuwn's thoughts which are too short to be their own \
blog; but just long enough to be a remark.\n\n{}",
REMARKS
@@ -57,7 +57,7 @@ pub fn module(router: &mut windmark::Router) {
.collect::<Vec<String>>()
.join("\n")
),
- context
+ &context
)
},
);
diff --git a/src/modules/search.rs b/src/modules/search.rs
index 5514b2f..d5fdc1f 100644
--- a/src/modules/search.rs
+++ b/src/modules/search.rs
@@ -161,7 +161,7 @@ pub(super) fn module(router: &mut windmark::Router) {
}
}
- crate::success!(response, context)
+ crate::response::success(&response, &context)
},
);
}
diff --git a/src/modules/sitemap.rs b/src/modules/sitemap.rs
index 10ae569..19c6b82 100644
--- a/src/modules/sitemap.rs
+++ b/src/modules/sitemap.rs
@@ -22,8 +22,8 @@ pub fn module(router: &mut windmark::Router) {
"/sitemap",
"A map of all publicly available routes on this Gemini capsule",
|context| {
- crate::success!(
- format!(
+ crate::response::success(
+ &format!(
"# Sitemap\n\nA map of all publicly available routes on this Gemini \
capsule\n\n{}",
(*crate::route::ROUTES.lock().unwrap())
@@ -32,7 +32,7 @@ pub fn module(router: &mut windmark::Router) {
.collect::<Vec<_>>()
.join("\n")
),
- context
+ &context
)
},
);
diff --git a/src/modules/skills.rs b/src/modules/skills.rs
index ce97f3e..45b42d9 100644
--- a/src/modules/skills.rs
+++ b/src/modules/skills.rs
@@ -64,7 +64,7 @@ pub fn module(router: &mut windmark::Router) {
"/skills",
"A Few Skills of Fuwn",
move |context| {
- crate::success!(format!("# Skills\n\n{}", skills.join("\n")), context)
+ crate::response::success(&format!("# Skills\n\n{}", skills.join("\n")), &context)
},
);
}
diff --git a/src/modules/stocks.rs b/src/modules/stocks.rs
index ff1a77d..20ab850 100644
--- a/src/modules/stocks.rs
+++ b/src/modules/stocks.rs
@@ -19,7 +19,7 @@
use once_cell::sync::Lazy;
use serde::Deserialize;
-use crate::{route::track_mount, success};
+use crate::{route::track_mount, response::success};
static REFERRALS: Lazy<Vec<Referral>> = Lazy::new(|| {
serde_json::from_str(include_str!(
@@ -112,8 +112,8 @@ pub fn module(router: &mut windmark::Router) {
"Want to start investing in the stock market? Support me by using one of \
my referral links!",
|context| {
- success!(
- format!(
+ success(
+ &format!(
"# Referrals\n\n=> /stocks Dashboard\n=> /cryptocurrency \
Cryptocurrency Dashboard\n=> /stocks/telegram Telegram Groups\n=> \
/stocks/search Search\n\nWant to start investing? Support me by \
@@ -126,7 +126,7 @@ pub fn module(router: &mut windmark::Router) {
.collect::<Vec<String>>()
.join("\n")
),
- context
+ &context
)
},
);
@@ -137,14 +137,14 @@ pub fn module(router: &mut windmark::Router) {
"Explore and search the stock market using Gemini!",
|context| {
async move {
- success!(
- format!(
+ success(
+ &format!(
"# The Stock Market\n\n=> /stocks/search Symbol Search\n=> /stocks/referrals Referrals\n=> /cryptocurrency Cryptocurrency Dashboard\n=> /stocks/telegram Telegram Groups\n\n## Popular \
Symbols\n\n### AAPL\n\n{}\n\n### TSLA\n\n{}\n\n## Credits\n\nFinancial data provided by\n\n=> https://finnhub.io/ Finnhub",
symbol_to_string("AAPL").await,
symbol_to_string("TSLA").await
),
- context
+ &context
)
}
},
@@ -190,12 +190,12 @@ pub fn module(router: &mut windmark::Router) {
}
}
- success!(
- format!(
+ success(
+ &format!(
"{}\n\n## Credits\n\nFinancial data provided by\n\n=> https://finnhub.io/ Finnhub",
response
),
- context
+ &context
)
}
},