Skip to main content

EventHandler

Trait EventHandler 

Source
pub trait EventHandler: Send + Sync {
    type PacketData: PacketData;
    type UserData;

    // Required methods
    fn on_receive<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        data: Self::PacketData,
        header: &'life1 Header,
        peer: &'life2 Arc<Connection<Self::PacketData>>,
        user: &'life3 Self::UserData,
        sender: &'life4 Arc<DataSender<Self::PacketData>>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
    fn on_connect_start<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        addr: &'life1 SocketAddr,
        key: String,
        peer: &'life2 Arc<Connection<Self::PacketData>>,
    ) -> Pin<Box<dyn Future<Output = Option<Self::UserData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn on_connect_done<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        peer: &'life1 Arc<Connection<Self::PacketData>>,
        user: &'life2 Self::UserData,
        sender: &'life3 Arc<DataSender<Self::PacketData>>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn on_disconnect<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        peer: &'life1 Arc<Connection<Self::PacketData>>,
        user: &'life2 Self::UserData,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}

Required Associated Types§

Required Methods§

Source

fn on_receive<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, data: Self::PacketData, header: &'life1 Header, peer: &'life2 Arc<Connection<Self::PacketData>>, user: &'life3 Self::UserData, sender: &'life4 Arc<DataSender<Self::PacketData>>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Source

fn on_connect_start<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, addr: &'life1 SocketAddr, key: String, peer: &'life2 Arc<Connection<Self::PacketData>>, ) -> Pin<Box<dyn Future<Output = Option<Self::UserData>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn on_connect_done<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, peer: &'life1 Arc<Connection<Self::PacketData>>, user: &'life2 Self::UserData, sender: &'life3 Arc<DataSender<Self::PacketData>>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source

fn on_disconnect<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, peer: &'life1 Arc<Connection<Self::PacketData>>, user: &'life2 Self::UserData, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§