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>;
}Required Methods§
fn listen(&self) -> BoxFuture<'static, T>
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".