3 releases

0.1.2 Jun 6, 2022
0.1.1 Feb 24, 2022
0.1.0 Dec 14, 2021

#1030 in Encoding

Download history 23/week @ 2024-11-16 65/week @ 2024-11-23 59/week @ 2024-11-30 128/week @ 2024-12-07 93/week @ 2024-12-14 18/week @ 2024-12-21 9/week @ 2024-12-28 50/week @ 2025-01-04 94/week @ 2025-01-11 66/week @ 2025-01-18 32/week @ 2025-01-25 57/week @ 2025-02-01 88/week @ 2025-02-08 54/week @ 2025-02-15 65/week @ 2025-02-22 39/week @ 2025-03-01

258 downloads per month
Used in 9 crates (2 directly)

MIT license

29KB
759 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

Other

  • u16 will be encoded as i32
  • u32 will be encoded as i64
  • u16 and u32 can't be decoded from jce

Dependencies

~165–450KB