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 Reader

Jce head code

Jce Writer

Enums

Errors

Key type for jce map

Jce Types

Value type covers all types in jce

Traits

Deserialize Jce Value

Serialize JceValue into Bytes

Functions

Read data from Buf

Read data as a anonymous struct and get the given tag value

Unbox a JceStruct and get the given tag value

Type Definitions

Results

Struct type for jce

Derive Macros