Track hashes for file contents

This commit is contained in:
Lukas Wirth 2024-05-14 11:21:04 +02:00
parent 580b8dab1a
commit 793396c624
2 changed files with 28 additions and 12 deletions

View file

@ -22,6 +22,10 @@ pub fn is_ci() -> bool {
option_env!("CI").is_some()
}
pub fn hash_once<Hasher: std::hash::Hasher + Default>(thing: impl std::hash::Hash) -> u64 {
std::hash::BuildHasher::hash_one(&std::hash::BuildHasherDefault::<Hasher>::default(), thing)
}
#[must_use]
#[allow(clippy::print_stderr)]
pub fn timeit(label: &'static str) -> impl Drop {