pub trait DynProtocolHandler:
Send
+ Sync
+ Debug
+ 'static {
// Required method
fn accept(
&self,
connection: Connection,
) -> Pin<Box<dyn Future<Output = Result<(), AcceptError>> + Send + '_>>;
// Provided methods
fn on_accepting(
&self,
accepting: Accepting,
) -> Pin<Box<dyn Future<Output = Result<Connection, AcceptError>> + Send + '_>> { ... }
fn shutdown(&self) -> Pin<Box<dyn Future<Output = ()> + Send + '_>> { ... }
}Expand description
A dyn-compatible version of ProtocolHandler that returns boxed futures.
Any type that implements ProtocolHandler automatically also implements DynProtocolHandler.
There is a also From impl to turn any type that implements ProtocolHandler into a
Box<dyn DynProtocolHandler>.