use template

This commit is contained in:
Mark
2025-07-21 13:55:21 +02:00
parent 80a86e9f8a
commit 19f51c5732
6 changed files with 632 additions and 160 deletions

View File

@@ -8,11 +8,12 @@ const REDIRECT: &'static str = "/srv/tomatenmhark-redirect/";
pub struct Status(
pub BTreeMap<String, (bool, bool, String, Option<String>, Option<Duration>)>,
pub BTreeMap<String, (bool, bool, String, Option<String>)>,
pub Duration,
);
impl Status {
pub fn empty() -> Self {
Self(Default::default(), Default::default())
}
pub fn query_sync(dbg: bool) -> Self {
let start = Instant::now();
let mut map = BTreeMap::new();
query_status_sync(
|k, e, r, v, dur| {
@@ -75,10 +76,9 @@ impl Status {
}
}
}
Self(map, rest, start.elapsed())
Self(map, rest)
}
pub async fn query_async(dbg: bool) -> Self {
let start = Instant::now();
let mut map = BTreeMap::new();
query_status_async(
|k, e, r, v, dur| {
@@ -137,7 +137,7 @@ impl Status {
}
}
}
Self(map, rest, start.elapsed())
Self(map, rest)
}
}