Something is ok

This commit is contained in:
Ara Sadoyan
2025-02-08 19:35:44 +01:00
parent cb3ff26de7
commit 79d952d30e
6 changed files with 91 additions and 67 deletions

22
src/utils/compare.rs Normal file
View File

@@ -0,0 +1,22 @@
use dashmap::DashMap;
use std::sync::atomic::AtomicUsize;
pub fn dashmaps(map1: &DashMap<String, (Vec<(String, u16)>, AtomicUsize)>, map2: &DashMap<String, (Vec<(String, u16)>, AtomicUsize)>) -> bool {
if map1.len() != map2.len() {
return false; // Different number of keys
}
for entry1 in map1.iter() {
let key = entry1.key();
let (vec1, _) = entry1.value(); // Extract value
if let Some(entry2) = map2.get(key) {
let (vec2, _) = entry2.value(); // Correctly extract value
if vec1 != vec2 {
return false;
}
} else {
return false;
}
}
true
}