2022-06-21 15:59:45 -03:00
|
|
|
use std::collections::hash_map::DefaultHasher;
|
|
|
|
|
use std::hash::{Hash, Hasher};
|
|
|
|
|
|
2022-07-12 10:26:16 -03:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
2022-06-21 15:59:45 -03:00
|
|
|
/// TODO(derezzedex)
|
|
|
|
|
pub struct Id(u64);
|
|
|
|
|
|
|
|
|
|
impl Id {
|
|
|
|
|
/// TODO(derezzedex)
|
|
|
|
|
pub fn new(id: impl Hash) -> Id {
|
|
|
|
|
let mut hasher = DefaultHasher::new();
|
|
|
|
|
id.hash(&mut hasher);
|
|
|
|
|
|
|
|
|
|
Id(hasher.finish())
|
|
|
|
|
}
|
|
|
|
|
}
|