#haxe #serialization #serde

haxeformat

Haxe serialization format in Rust

5 releases

0.2.3 Apr 4, 2023
0.2.2 Jun 18, 2020
0.2.1 Jun 10, 2020
0.2.0 May 28, 2020
0.1.0 May 11, 2020

#866 in Encoding

33 downloads per month
Used in 5 crates (via etwin_twinoid_client)

MIT license

150KB
4K SLoC

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

lib.rs:

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

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

Dependencies

~2.5MB
~42K SLoC