8 个版本
0.2.0 | 2024年3月15日 |
---|---|
0.1.4 | 2023年10月4日 |
0.1.3 | 2023年9月21日 |
0.1.0 |
|
0.0.2 | 2023年8月9日 |
#1243 in 网络编程
80KB
2K SLoC
Protokit
Rust协议缓冲区的实现。
为什么不使用prost/pb-j/rust-protobuf?
最初是因我需要支持textformat。
any_value {
[type.googleapis.com/com.example.SomeType] {
field1: "hello"
}
}
在调查其他crate之后,我发现它们有其他问题(在rust-protobuf中需要装箱,prost的代码生成混乱)。
特性
- 二进制(100% 兼容)+ 文本(90% 兼容)格式支持
- 不需要消息装箱
- GRPC(可用于tonic)
- 创建消息实现的良好推导宏,无需proto编译器
#[derive(Default, Debug, Clone, BinProto)]
pub struct FieldPath {
#[field(1, varint, packed)]
pub fields: Vec<u32>,
}
#[derive(Default, Debug, Clone, BinProto)]
pub struct FieldMask {
#[field(1, nested, repeated)]
pub paths: Vec<FieldPath>,
}
依赖关系
~2–12MB
~127K SLoC