ctp_rust/lib.rs
1//! # CTP Rust SDK
2//!
3//! 这是一个为CTP (综合交易平台) 提供的安全Rust绑定库,支持Linux和macOS系统。
4//!
5//! ## 功能特点
6//!
7//! - 🔒 类型安全的Rust绑定
8//! - 🌍 支持Linux和macOS平台
9//! - 📝 自动处理GB18030到UTF-8编码转换
10//! - ⚡ 异步支持
11//! - 📚 完整的中文文档
12//!
13//! ## 模块结构
14//!
15//! - `ffi` - C++库的FFI绑定
16//! - `encoding` - 编码转换工具
17//! - `api` - 高级API接口
18//! - `error` - 错误处理
19//! - `types` - 类型定义
20
21pub mod api;
22pub mod config;
23pub mod encoding;
24pub mod error;
25pub mod ffi;
26pub mod types;
27// 重新导出主要类型和函数
28pub use api::{AsyncMdApi, MdApi, TraderApi};
29pub use config::CtpConfig;
30pub use error::{CtpError, CtpResult};
31pub use types::*;
32/// 库版本信息
33pub const VERSION: &str = env!("CARGO_PKG_VERSION");
34
35#[cfg(test)]
36mod tests {
37 use super::*;
38
39 #[test]
40 fn test_version() {
41 assert!(!VERSION.is_empty());
42 }
43}