use std::any::TypeId; use std::fmt::Debug; use std::hash::Hash; pub trait Event: Debug + 'static { fn id(&self) -> Id; } /// The ID of a [`Event`]. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct Id { inner: TypeId, } impl Id { /// Returns the id of a [`Event`]; pub fn of() -> Self { Self { inner: TypeId::of::() } } }