implement visitors count macro for each directory index

This commit is contained in:
yggverse 2025-06-28 18:13:17 +03:00
parent 450bbe60f3
commit 56830be4a9
7 changed files with 35 additions and 19 deletions

View file

@ -37,15 +37,22 @@ impl Request {
}
}
pub fn total(&self) -> usize {
pub fn total(&self, query_prefix: Option<&str>) -> usize {
let mut t = 0;
if let Some(ref this) = self.0 {
let mut t = 0;
for c in this.read().unwrap().values() {
t += c.len()
for queries in this.read().unwrap().values() {
match query_prefix {
Some(p) => {
for q in queries {
if q.value.starts_with(p) {
t += 1
}
}
}
None => t += queries.len(),
}
}
t
} else {
0
}
t
}
}