DynProtocolHandler

Trait DynProtocolHandler 

Source
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>.

Required Methods§

Source

fn accept( &self, connection: Connection, ) -> Pin<Box<dyn Future<Output = Result<(), AcceptError>> + Send + '_>>

Provided Methods§

Source

fn on_accepting( &self, accepting: Accepting, ) -> Pin<Box<dyn Future<Output = Result<Connection, AcceptError>> + Send + '_>>

Source

fn shutdown(&self) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>

Trait Implementations§

Source§

impl<T: ProtocolHandler> From<T> for Box<dyn DynProtocolHandler>

Source§

fn from(value: T) -> Self

Converts to this type from the input type.

Implementors§