chorba_macro 0.1.0

chorba macro
Documentation
  • Coverage
  • 0%
    0 out of 3 items documented0 out of 2 items with examples
  • Size
  • Source code size: 7.11 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 283.68 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 7s Average build duration of successful builds.
  • all releases: 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Documentation
  • myyrakle/chorba
    2 0 5
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • myyrakle

chorba

GitHub license

  • simple binary serialization

Basic

  • Serializes a structure into binary format.
  • The values ​​are placed in the order of the structure fields, so the actual order of the fields is important.

Get Started

Install via cargo add

cargo add chorba

or, Modify Cargo.toml.

chorba = "0.1.0"

The usage is simple. Just apply the logic through derive and convert it through the encode/decode functions.

use chorba::{Decode, Encode, decode, encode};

#[derive(Encode, Decode, Debug)]
pub struct TestPacket {
    user_id: String,
    user_name: String,
    user_email: String,
}

fn main() {
    let encoded = encode(&TestPacket {
        user_id: "123".to_string(),
        user_name: "John Doe".to_string(),
        user_email: "myyrakle@naver.com".to_string(),
    });

    println!("encoded: {:?}", encoded);

    let decoded: TestPacket = decode(&encoded).unwrap();
    println!("decoded: {:?}", decoded);
}