From bf5a6841ffeb29ffcf718b8fbf80fea91074c58e Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sat, 16 Apr 2022 01:57:11 -0700 Subject: refactor: route for future use --- src/route.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/route.rs') 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 // 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); } -- cgit v1.2.3