6 个版本
使用旧的 Rust 2015
| 0.1.1 | 2018 年 6 月 23 日 |
|---|---|
| 0.1.0 | 2018 年 6 月 18 日 |
| 0.0.4 | 2018 年 6 月 13 日 |
#30 在 #double
87KB
2.5K SLoC
tars-stream
用于腾讯/Tars TARS 协议的编码/解码
tars 类型与 rust 类型映射关系
| Tars 类型 | Rust 类型 |
|---|---|
| bool | bool |
| byte | i8 |
| short | i16 |
| int | i32 |
| long | i64 |
| float | f32 |
| double | f64 |
| string | String |
| unsigned byte | u8(兼容 tars::Short) |
| unsigned short | u16(兼容 tars::Int32) |
| unsigned int | u32(兼容 tars::Int64) |
| vector |
bytes::Bytes |
| vector | Vec |
| map |
BTreeMap |
tars 协议的坑
- optional 即使不设值(Rust 使用 Option 表示完全没问题),其他实现中也会对 optional 给予默认值,导致 optional 只能用于兼容老版本协议,而不能用具 optional 字段鉴别
- tars::UInt8 以 tars::Int16 表示,tars::UInt16 以 tars::Int32 表示,tars::UInt32 以 tars::Int64 表示
依赖
~435KB