This library exposes a standardized API across a number of file formats, as well as providing traits to make it possible to dynamically choose file serialization/deserialization format at runtime or based on generics.
Each file format is toggled via feature, all of which are disabled by default.
Currently the only supported file formats are:
- Bincode (via bincode
)
- CBOR (via serde_cbor
)
- JSON (via serde_json
)
- MessagePack (via rmp
and rmp-serde
)
- RON (via ron
)
- TOML (via toml
)
- XML (via serde-xml-rs
)
If you would like to add more file formats, feel free to make a pull request.
```rust use serdemulti::{SerdeText, Error}; use serdemulti::formats::json::Json; use std::collections::HashMap;
let mut value: HashMap
// Json
can be swapped out for any value that implements SerdeText
here.
let s = Json.to_string(&value).expect("failed to serialize");
println!("serialized: {}", s);
```