| Crates.io | chorba_macro |
| lib.rs | chorba_macro |
| version | 0.1.0 |
| created_at | 2025-04-14 15:56:25.097103+00 |
| updated_at | 2025-04-14 15:56:25.097103+00 |
| description | chorba macro |
| homepage | https://github.com/myyrakle/chorba/blob/master/README.md |
| repository | https://github.com/myyrakle/chorba |
| max_upload_size | |
| id | 1633024 |
| size | 7,111 |
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);
}