#jce #lib #encode-decode #proc-macro #jcers

jcers_proc

为jcers提供的proc宏

1个不稳定版本

0.1.0 2021年12月14日

#139#encode-decode

Download history 107/week @ 2024-04-01 58/week @ 2024-04-08 69/week @ 2024-04-15 68/week @ 2024-04-22 72/week @ 2024-04-29 73/week @ 2024-05-06 67/week @ 2024-05-13 72/week @ 2024-05-20 70/week @ 2024-05-27 57/week @ 2024-06-03 52/week @ 2024-06-10 66/week @ 2024-06-17 77/week @ 2024-06-24 29/week @ 2024-07-08 64/week @ 2024-07-15

每月177 次下载
10 个crate中使用了(通过 jcers

MIT 许可证

7KB
123

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

依赖

~1.5MB
~36K SLoC