diff options
| author | Fuwn <[email protected]> | 2022-04-16 01:57:11 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-04-16 01:57:11 -0700 |
| commit | bf5a6841ffeb29ffcf718b8fbf80fea91074c58e (patch) | |
| tree | bd529f566412f92b6f4f609832252874acee422a /src/route.rs | |
| parent | feat: add explicit licensing terms (diff) | |
| download | locus-bf5a6841ffeb29ffcf718b8fbf80fea91074c58e.tar.xz locus-bf5a6841ffeb29ffcf718b8fbf80fea91074c58e.zip | |
refactor: route for future use
Diffstat (limited to 'src/route.rs')
| -rw-r--r-- | src/route.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/route.rs b/src/route.rs index 66d09cc..1c4b128 100644 --- a/src/route.rs +++ b/src/route.rs @@ -16,6 +16,19 @@ // Copyright (C) 2022-2022 Fuwn <[email protected]> // SPDX-License-Identifier: GPL-3.0-only +pub struct Route { + pub description: String, + pub text_cache: String, +} +impl Route { + pub fn new(description: &str) -> Self { + Self { + description: description.to_string(), + text_cache: "".to_string(), + } + } +} + pub fn hits_from(route: &str) -> i32 { if let Ok(database) = crate::DATABASE.lock() { (*database) @@ -33,6 +46,6 @@ pub fn track_mount( handler: windmark::handler::RouteResponse, ) { (*crate::ROUTES.lock().unwrap()) - .insert(route.to_string(), description.to_string()); + .insert(route.to_string(), Route::new(description)); router.mount(route, handler); } |