diff options
| author | Fuwn <[email protected]> | 2022-04-27 01:17:32 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-04-27 01:17:32 -0700 |
| commit | c81eab0c3b4fa8d8433505bd3d061f8de8e87d74 (patch) | |
| tree | 09451b5ebec415295d63504e9eaffecb37277a68 /src/route.rs | |
| parent | refactor(modules): move search out of module (diff) | |
| download | locus-c81eab0c3b4fa8d8433505bd3d061f8de8e87d74.tar.xz locus-c81eab0c3b4fa8d8433505bd3d061f8de8e87d74.zip | |
refactor: restrict more
Diffstat (limited to 'src/route.rs')
| -rw-r--r-- | src/route.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/route.rs b/src/route.rs index 285d049..032381d 100644 --- a/src/route.rs +++ b/src/route.rs @@ -16,17 +16,18 @@ // Copyright (C) 2022-2022 Fuwn <[email protected]> // SPDX-License-Identifier: GPL-3.0-only -use std::{lazy::SyncLazy, sync::Mutex}; +use std::{collections::HashMap, lazy::SyncLazy, sync::Mutex}; use tokio::time::Instant; -use crate::ROUTES; - #[cfg(debug_assertions)] pub const CACHE_RATE: u64 = 1; #[cfg(not(debug_assertions))] pub const CACHE_RATE: u64 = 60 * 5; +pub static ROUTES: SyncLazy<Mutex<HashMap<String, Route>>> = + SyncLazy::new(|| Mutex::new(HashMap::new())); + #[derive(Debug)] pub struct Route { pub description: String, |