#messagepack #json #toml #convert #deserialize #value #macro-use #usize

serdeconv

This crate provides convenient traits and functions for converting between TOML/JSON/MessagePack strings and serializable values

5 unstable releases

Uses old Rust 2015

0.4.1 Mar 31, 2023
0.4.0 May 5, 2020
0.3.0 Jun 15, 2017
0.2.1 May 14, 2017
0.2.0 May 6, 2017

#2457 in Encoding

Download history 159/week @ 2024-12-21 86/week @ 2024-12-28 158/week @ 2025-01-04 318/week @ 2025-01-11 221/week @ 2025-01-18 213/week @ 2025-01-25 225/week @ 2025-02-01 272/week @ 2025-02-08 267/week @ 2025-02-15 265/week @ 2025-02-22 307/week @ 2025-03-01 645/week @ 2025-03-08 581/week @ 2025-03-15 408/week @ 2025-03-22 276/week @ 2025-03-29 1470/week @ 2025-04-05

2,847 downloads per month
Used in 6 crates

MIT license

21KB
343 lines

This crate provides convenient traits and functions for converting between TOML/JSON/MessagePack strings and serializable values.

This is highly depends on the serde crate.

Examples

Converts from a TOML string to a serializable value:

extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serdeconv;

use serdeconv::FromToml;

// Defines a deserializable struct.
#[derive(Deserialize)]
struct Foo {
    bar: String,
    baz: usize
}
impl FromToml for Foo {}

// Converts from the TOML string to a `Foo` value.
let toml = r#"
bar = "aaa"
baz = 123
"#;
let foo = Foo::from_toml_str(toml).unwrap();
assert_eq!(foo.bar, "aaa");
assert_eq!(foo.baz, 123);

serdeconv

Build Status License: MIT

This crate provides convenient traits and functions for converting between TOML/JSON/MessagePack strings and serializable values.

This is highly depends on the serde crate.

Documentation

Dependencies

~3MB
~68K SLoC