1 unstable release

0.1.0 Dec 14, 2021

#129 in #encode-decode

Download history 64/week @ 2024-07-22 51/week @ 2024-07-29 57/week @ 2024-08-05 80/week @ 2024-08-12 43/week @ 2024-08-19 58/week @ 2024-08-26 60/week @ 2024-09-02 56/week @ 2024-09-09 57/week @ 2024-09-16 82/week @ 2024-09-23 57/week @ 2024-09-30 59/week @ 2024-10-14 48/week @ 2024-10-21 46/week @ 2024-10-28 52/week @ 2024-11-04

205 downloads per month
Used in 10 crates (via jcers)

MIT license

7KB
123 lines

Jcers

A Encode/Decode lib for Jce.

Features

  • derive: derive macro support

How to use

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

Dependencies

~1.5MB
~37K SLoC