26 releases

0.1.31 Nov 12, 2024
0.1.30 Nov 12, 2024
0.1.28 Aug 6, 2024
0.1.27 Jul 18, 2024
0.1.4 Apr 25, 2024

#1018 in Encoding

Download history 3/week @ 2024-08-16 74/week @ 2024-09-13 11/week @ 2024-09-20 4/week @ 2024-09-27 4/week @ 2024-10-11 2/week @ 2024-10-18 18/week @ 2024-10-25 155/week @ 2024-11-01 244/week @ 2024-11-08 65/week @ 2024-11-15 34/week @ 2024-11-22 12/week @ 2024-11-29

364 downloads per month
Used in 2 crates (via r2dma)

MIT/Apache

53KB
1.5K SLoC

derse

Rust Crates.io Version codecov

A simple binary serialization protocol for Rust.

Usage

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);

Dependencies

~1.3–2MB
~42K SLoC