Skip to main content

flare_core/common/protocol/
mod.rs

1//! Flare 协议模块
2//!
3//! 包含 protobuf 生成的消息定义和快速构建工具
4
5// 生成的文件需要通过 prost-build 生成
6// 文件结构:
7// - flare.core.rs: Frame 和 Reliability 定义
8// - flare.core.commands.rs: Command 及其子类型定义
9
10// 手动组织模块结构
11// 注意:prost 会根据 package 名称生成模块,但我们需要直接包含生成的文件
12pub mod flare {
13    pub mod core {
14        // 先定义 commands 模块(Frame 需要引用它)
15        pub mod commands {
16            include!("flare.core.commands.rs");
17        }
18
19        // Frame 和 Reliability - 直接从生成的文件中包含
20        // build.rs 已经修复了 commands 的引用为 super::commands
21        pub mod flare_core {
22            include!("flare.core.rs");
23        }
24
25        pub use flare_core::{Frame, Reliability};
26
27        // 重新导出常用类型
28        pub use commands::{
29            Command, CustomCommand, NotificationCommand, PayloadCommand, SystemCommand,
30        };
31    }
32}
33
34// 快速构建方法
35pub mod builder;
36
37// 序列化示例(仅用于测试和文档)
38#[cfg(test)]
39pub mod serde_example;
40
41// 重新导出常用类型和构建器
42pub use builder::*;
43pub use flare::core::commands::system_command::SerializationFormat;
44pub use flare::core::commands::*;
45pub use flare::core::{Frame, Reliability};