futu_core/
handler.rs

1use async_trait::async_trait;
2
3/// FutuOpenD 连接事件回调 trait
4///
5/// 实现此 trait 以处理连接生命周期事件和服务端推送。
6#[async_trait]
7pub trait FutuHandler: Send + Sync + 'static {
8    /// 连接成功回调
9    async fn on_connected(&self, conn_id: u64);
10
11    /// 断开连接回调
12    async fn on_disconnected(&self, conn_id: u64, reason: &str);
13
14    /// 接收到服务端推送
15    async fn on_push(&self, proto_id: u32, payload: &[u8]) -> crate::error::Result<()>;
16}