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