pub trait EventHandler {
type ClientUserData: Default + Send + Sync;
// Required method
fn on_request(
&self,
peer: &mut PeerContext<Self::ClientUserData>,
request: Value,
) -> impl Future<Output = Result<Value>> + Send;
// Provided methods
fn on_connect(
&self,
_id: u64,
) -> impl Future<Output = Result<Self::ClientUserData>> + Send { ... }
fn on_disconnect(&self, _id: u64) -> impl Future<Output = ()> + Send { ... }
}
Required Associated Types§
type ClientUserData: Default + Send + Sync
Required Methods§
fn on_request( &self, peer: &mut PeerContext<Self::ClientUserData>, request: Value, ) -> impl Future<Output = Result<Value>> + Send
Provided Methods§
fn on_connect( &self, _id: u64, ) -> impl Future<Output = Result<Self::ClientUserData>> + Send
fn on_disconnect(&self, _id: u64) -> impl Future<Output = ()> + Send
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.