17 lines
346 B
Rust
17 lines
346 B
Rust
|
|
use std::collections::hash_map::DefaultHasher;
|
||
|
|
use std::hash::{Hash, Hasher};
|
||
|
|
|
||
|
|
#[derive(Debug, PartialEq, Eq, Hash)]
|
||
|
|
/// 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())
|
||
|
|
}
|
||
|
|
}
|