haxeformat

Crates.iohaxeformat
lib.rshaxeformat
version0.2.3
created_at2020-05-11 14:26:08.050974+00
updated_at2023-04-04 18:11:49.323497+00
descriptionHaxe serialization format in Rust
homepage
repositoryhttps://gitlab.com/eternal-twin/tools/haxeformat
max_upload_size
id240128
size147,901
(moulins)

documentation

README

Haxeformat

Rust implementation of the Haxe serialization format, with serde support.

Documentation

Usage

use serde::{ Serialize, Deserialize };

#[derive(Debug, Eq, PartialEq, Serialize, Deserialize)]
struct Person {
    name: String,
    surname: String,
    age: u32,
}

let person = Person { name: "John".to_owned(), surname: "Doe".to_owned(), age: 42 };
let serialized = "oy4:namey4:Johny7:surnamey3:Doey3:agei42g";

assert_eq!(haxeformat::from_str::<Person>(serialized).unwrap(), person);
assert_eq!(haxeformat::to_string::<Person>(&person).unwrap(), serialized);
Commit count: 0

cargo fmt