Crates.io | seen_set |
lib.rs | seen_set |
version | 0.1.1 |
source | src |
created_at | 2024-07-06 17:21:53.758729 |
updated_at | 2024-07-06 18:44:22.383452 |
description | HashSet that doesn't store values. |
homepage | |
repository | https://github.com/dsherret/seen_set |
max_upload_size | |
id | 1294215 |
size | 14,117 |
A HashSet that doesn't store values, but instead only stores hashes.
This is useful when you only need to tell if you've seen a value before and you don't want to clone the value for performance reasons.
let mut seen = SeenSet::new();
for path in some_func_that_may_return_duplicate_paths() {
if !seen.insert(&path) {
continue;
}
// we haven't seen this path before
}
Note: This will be slower for values like numbers. Just use a regular HashSet for that.