Crate jcers

Source
Expand description

§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

JceCodeJceTypeRustType
0u8u8
1i16i16
2i32i32
3i64i64
4f32f32
5f64f64
6ShortStringString
7LongStringString
8MapHashMap<K, V>
9ListVec<V>
10StructT
11StructEnd-
12EmptyT::default()
13bytesbytes::Bytes

§Other

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

Structs§

Jce
Jce Reader
JceHead
Jce head code
JceMut
Jce Writer

Enums§

JceError
Errors
JceMapKey
Key type for jce map
JceType
Jce Types
JceValue
Value type covers all types in jce

Traits§

JceGet
Deserialize Jce Value
JcePut
Serialize JceValue into Bytes

Functions§

from_buf
Read data from Buf
from_buf_with_tag
Read data as a anonymous struct and get the given tag value
from_buf_with_tag_unbox
Unbox a JceStruct and get the given tag value

Type Aliases§

JceResult
Results
JceStruct
Struct type for jce

Derive Macros§

JceGet
JcePut