ConnectionCallback

Trait ConnectionCallback 

Source
pub trait ConnectionCallback {
    // Required methods
    fn close<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        connection: &'life1 Connection,
        close: Close,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn blocked<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        connection: &'life1 Connection,
        reason: String,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn unblocked<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        connection: &'life1 Connection,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

Callback interfaces for asynchronous Connection class message.

See module documentation for general guidelines.

Required Methods§

Source

fn close<'life0, 'life1, 'async_trait>( &'life0 mut self, connection: &'life1 Connection, close: Close, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Callback to handle close connection request from server.

Returns Ok to reply server that the request is received and handled properly.

§Errors

If returns Err, no reply to server, which means server won’t know whether the request has been received by client, and may consider the connection isn’t shutdown.

Source

fn blocked<'life0, 'life1, 'async_trait>( &'life0 mut self, connection: &'life1 Connection, reason: String, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Callback to handle connection blocked indication from server

Source

fn unblocked<'life0, 'life1, 'async_trait>( &'life0 mut self, connection: &'life1 Connection, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Callback to handle connection unblocked indication from server

Implementors§