futu_core/lib.rs
1//! `futu-core` — 共享类型 / 错误 / 协议 ID / 日志
2//!
3//! ## 模块稳定性分层(v1.4.89 API audit)
4//!
5//! | Module | 稳定性 | 跨 crate 消费者 |
6//! |---|---|---|
7//! | [`error`] | **Stable** | futu-codec / futu-net / futu-qot / futu-trd / futu-gateway / futu-rest / futu-backend / futu-server |
8//! | [`proto_id`] | **Stable** | 同上 + futu-opend tests |
9//! | [`log`] | **Stable** | futu-opend 主程序 / examples / futu-mcp |
10//! | [`market`] | **Stable** | futu-gateway handlers / bridge |
11//! | [`exch_type`] | **Stable** (v1.4.93) | futu-gateway / futu-rest / futucli / futu-mcp / futu-qot |
12//! | [`account_locator`] | **Stable** (v1.4.109) | futu-cache / futu-trd / futu-rest / futu-mcp / futucli |
13//! | [`handler`] | **Internal** — 当前无 implementor,保留占位 | — |
14//!
15//! ### 稳定性约定
16//!
17//! - **Stable**:外部二进制(例如 futu-opend / futu-mcp)和 examples 可依赖。
18//! 修改(签名 / 枚举变体 / 字段)走 SemVer breaking 流程。
19//! - **Internal**:模块内 `pub` 但**不承诺稳定**,下版可能调整签名或 gate 为
20//! `pub(crate)`。新外部调用方请 consult maintainer。
21
22/// Stable API — 统一错误类型与 `Result<T>` 别名,跨 10+ crate 消费。
23pub mod error;
24
25/// Internal API — 连接事件回调 trait,当前无任何 implementor。保留占位以便
26/// 未来需要 SDK 抽象时直接使用。
27///
28/// **不要在新代码里依赖此 trait**(下版可能签名变化或移动到 `futu-net`)。
29pub mod handler;
30
31/// Stable API — 日志初始化入口(stderr fmt / JSON / audit-jsonl 三种模式)。
32/// futu-opend / futu-mcp / examples 用。
33pub mod log;
34
35/// Stable API — 市场 enum 与时区 dispatch(v1.4.69 跨 crate 共享)。
36/// futu-gateway handlers / bridge / qot util 用。
37pub mod market;
38
39/// Stable API — `ExchType` enum → exchange code 字符串(v1.4.93 跨 crate 共享)。
40/// REST adapter / futucli / MCP / qot SDK 用. 对齐 `proto/Qot_Common.proto::ExchType`.
41pub mod exch_type;
42
43/// Stable API — 账户定位纯规则(acc_id / card_num / uni_card_num)。
44/// Surface 只能调用这些规则,不应各自手写 4 位卡号、16 位卡号、白名单和可见
45/// 卡号匹配语义。
46pub mod account_locator;
47
48/// **Stable** (v1.4.110) — QOT broker-aware stock/security key.
49///
50/// 用于 SubscriptionManager / QotCache / push registry / GetSubInfo 全栈对齐
51/// C++ `StockKey(stock_id, broker_id)`. 数字货币 multi-broker 场景下让同一
52/// stock_id 的不同 broker 订阅独立隔离, 避免 push 混投 + cache 互相覆盖.
53///
54/// 跨 crate 消费者: futu-server (SubscriptionManager) / futu-cache (QotCache) /
55/// futu-gateway-qot (15 behavior-aware handler) / futu-backend (CMD6211 wire).
56pub mod qot_stock_key;
57
58/// Stable API — FutuOpenD API 协议 ID 常量(对齐 C++ `FTAPI_Define_ProtoID.h`)。
59/// 所有 network / handler / test 代码用。
60pub mod proto_id;