use std::{
fmt,
hash::{Hash, Hasher},
sync::Arc,
};
#[derive(Clone)]
pub(crate) struct InstanceId(Arc<()>);
impl InstanceId {
pub(crate) fn new() -> Self {
Self(Arc::new(()))
}
}
impl PartialEq for InstanceId {
fn eq(&self, other: &Self) -> bool {
Arc::ptr_eq(&self.0, &other.0)
}
}
impl Eq for InstanceId {}
impl Hash for InstanceId {
fn hash<H: Hasher>(&self, state: &mut H) {
Arc::as_ptr(&self.0).hash(state);
}
}
impl fmt::Debug for InstanceId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("InstanceId(..)")
}
}