| Crates.io | derse |
| lib.rs | derse |
| version | 0.1.33 |
| created_at | 2024-04-23 08:09:14.240344+00 |
| updated_at | 2025-01-23 08:48:21.134986+00 |
| description | A simple binary serialization protocol for Rust. |
| homepage | https://github.com/SF-Zhou/derse |
| repository | https://github.com/SF-Zhou/derse |
| max_upload_size | |
| id | 1217274 |
| size | 79,078 |
A simple binary serialization protocol for Rust.
To use this library, add the following to your Cargo.toml:
[dependencies]
derse = "0.1"
Then, you can import and use the components as follows:
use derse::{Deserialize, DownwardBytes, Serialize};
// 1. serialization for basic types.
let ser = "hello world!";
let bytes = ser.serialize::<DownwardBytes>().unwrap();
let der = String::deserialize(&bytes[..]).unwrap();
assert_eq!(ser, der);
// 2. serialization for custom structs.
#[derive(Debug, Default, Deserialize, Serialize, PartialEq)]
pub struct Demo {
a: i32,
b: String,
c: Vec<String>,
}
let ser = Demo::default();
let bytes = ser.serialize::<DownwardBytes>().unwrap();
let der = Demo::deserialize(&bytes[..]).unwrap();
assert_eq!(ser, der);