use std::fmt::Debug; use std::any::Any; pub struct AbstractEvent { inner: Box, } impl AbstractEvent { pub fn new(event: E) -> AbstractEvent { AbstractEvent { inner: Box::new(event), } } pub fn downcast(&self) -> Option<&E> { self.inner.downcast_ref::() } pub fn is(&self) -> bool { self.inner.is::() } } pub trait Event: Any + Debug {}