FutuHandler

Trait FutuHandler 

Source
pub trait FutuHandler:
    Send
    + Sync
    + 'static {
    // Required methods
    fn on_connected<'life0, 'async_trait>(
        &'life0 self,
        conn_id: u64,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn on_disconnected<'life0, 'life1, 'async_trait>(
        &'life0 self,
        conn_id: u64,
        reason: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn on_push<'life0, 'life1, 'async_trait>(
        &'life0 self,
        proto_id: u32,
        payload: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

FutuOpenD 连接事件回调 trait

实现此 trait 以处理连接生命周期事件和服务端推送。

Required Methods§

Source

fn on_connected<'life0, 'async_trait>( &'life0 self, conn_id: u64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

连接成功回调

Source

fn on_disconnected<'life0, 'life1, 'async_trait>( &'life0 self, conn_id: u64, reason: &'life1 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

断开连接回调

Source

fn on_push<'life0, 'life1, 'async_trait>( &'life0 self, proto_id: u32, payload: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

接收到服务端推送

Implementors§