diff options
| author | Fuwn <[email protected]> | 2022-04-17 22:08:16 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-04-17 22:08:16 -0700 |
| commit | 11c9a673dff462d47a7a83b5378d0611b154c86f (patch) | |
| tree | b11bb67f237b8c92e73d429a9fcd17eac6162455 /src | |
| parent | refactor: decrease cache rate (diff) | |
| download | locus-11c9a673dff462d47a7a83b5378d0611b154c86f.tar.xz locus-11c9a673dff462d47a7a83b5378d0611b154c86f.zip | |
build(rustc): bump toolchain
Diffstat (limited to 'src')
| -rw-r--r-- | src/macros.rs | 12 | ||||
| -rw-r--r-- | src/route.rs | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/macros.rs b/src/macros.rs index 7d3868c..f0e805f 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -22,7 +22,7 @@ macro_rules! success { Response::Success( Main { body: &$body, - hits: &crate::route::hits_from($context.url.path()), + hits: &$crate::route::hits_from($context.url.path()), quote: { use rand::seq::SliceRandom; @@ -43,15 +43,15 @@ macro_rules! success { #[macro_export] macro_rules! mount_page { ($router:ident, $at:literal, $description:literal, $file:literal) => { - (*crate::ROUTES.lock().unwrap()) - .insert($at.to_string(), crate::route::Route::new($description)); + (*$crate::ROUTES.lock().unwrap()) + .insert($at.to_string(), $crate::route::Route::new($description)); ($router).mount( $at, Box::new(|context| { let content = include_str!(concat!("../content/pages/", $file, ".gmi")); - crate::route::cache(&context, &content); + $crate::route::cache(&context, &content); success!(content, context) }), ); @@ -61,8 +61,8 @@ macro_rules! mount_page { #[macro_export] macro_rules! mount_file { ($router:ident, $at:literal, $description:literal, $file:literal) => { - (*crate::ROUTES.lock().unwrap()) - .insert($at.to_string(), crate::route::Route::new($description)); + (*$crate::ROUTES.lock().unwrap()) + .insert($at.to_string(), $crate::route::Route::new($description)); ($router).mount( $at, diff --git a/src/route.rs b/src/route.rs index 251370c..7dfa5e7 100644 --- a/src/route.rs +++ b/src/route.rs @@ -65,7 +65,7 @@ pub fn cache(context: &windmark::returnable::RouteContext<'_>, response: &str) { >= std::time::Duration::from_secs(crate::CACHE_RATE) || (*ROUTES.lock().unwrap()) .get(context.url.path()) - .is_some_with(|&r| r.text_cache.is_empty()) + .is_some_and(|&r| r.text_cache.is_empty()) { (*LAST_CACHED.lock().unwrap()) = Instant::now(); |