#toml

tomlconv

This crate provides convenient traits and functions for converting between TOML and serializable values

3 releases

Uses old Rust 2015

0.1.2 May 6, 2017
0.1.1 May 6, 2017
0.1.0 May 6, 2017

#22 in #messagepack

Download history 21/week @ 2022-06-09 29/week @ 2022-06-16 21/week @ 2022-06-23 24/week @ 2022-06-30 24/week @ 2022-07-07 21/week @ 2022-07-14 30/week @ 2022-07-21 31/week @ 2022-07-28 24/week @ 2022-08-04 24/week @ 2022-08-11 28/week @ 2022-08-18 25/week @ 2022-08-25 24/week @ 2022-09-01 28/week @ 2022-09-08 30/week @ 2022-09-15 25/week @ 2022-09-22

110 downloads per month

MIT license

10KB
132 lines

tomlconv

Crates.io: tomlconv Build Status License: MIT

This crate provides convenient traits and functions for converting between TOML and serializable values.

Documentation


lib.rs:

This crate provides convenient traits and functions for converting between TOML and serializable values.

Examples

Converts from a TOML string to a serializable value:

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

use tomlconv::FromToml;

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

# fn main() {
// 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);
# }

Dependencies

~1MB
~19K SLoC