Skip to main content

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

Internal API — do not depend on stability.

FutuOpenD 连接事件回调 trait,定义连接生命周期事件和服务端推送回调。

v1.4.89 API audit:grep 全仓库发现当前没有任何 implementor(futu-net / futu-server / futu-gateway 都没 impl),仅 plans/archive/ 旧设计文档里 提到。保留该 trait 占位是为了未来 SDK 抽象(若把 backend connection 拆出独立 crate 供第三方使用时直接沿用)。

下版若仍无 implementor,可能:

  • 改 gate 为 pub(crate) 或删除(若确认不需要 SDK 抽象)
  • 或移动到 futu-net 作为连接层内部 trait

新外部依赖请先 consult maintainer。

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§