pub trait Event<T> {
// Required methods
fn listen(&self) -> BoxFuture<'static, T>;
fn clone_dyn(&self) -> Box<dyn Event<T>>;
}Expand description
The Event trait defines an object that can be used as an Event
This is a trait that defines the listen function that returns a future
so that it can be used in async code.
use futures::future::BoxFuture;
pub trait Event<T> {
fn listen(&self) -> BoxFuture<'static, T>;
}