3个版本
| 0.1.2 | 2022年6月6日 |
|---|---|
| 0.1.1 | 2022年2月24日 |
| 0.1.0 | 2021年12月14日 |
在编码中排名1450
每月下载量219
在9个crate中使用 (2直接使用)
29KB
759 行
Jcers
用于Jce的编码/解码库。
特性
derive:支持 derive 宏
如何使用
use jcers::{JceGet, JcePut};
#[derive(Debug, Default, JceGet, JcePut)]
pub struct YouJceStruct { // only support NamedStruct
#[jce(0)] // jce tag
pub a_named_field: u8, // a field
}
let s: YouJceStruct = jcers::from_buf(&mut buf).unwrap(); // buf should impl bytes::Buf
JceType
| JceCode | JceType | RustType |
|---|---|---|
| 0 | u8 | u8 |
| 1 | i16 | i16 |
| 2 | i32 | i32 |
| 3 | i64 | i64 |
| 4 | f32 | f32 |
| 5 | f64 | f64 |
| 6 | ShortString | String |
| 7 | LongString | String |
| 8 | Map | HashMap<K, V> |
| 9 | List | Vec<V> |
| 10 | Struct | T |
| 11 | StructEnd | - |
| 12 | Empty | T::default() |
| 13 | bytes | bytes::Bytes |
其他
u16将被编码为i32u32将被编码为i64u16和u32无法从jce解码
依赖
~130–385KB