2 个版本

使用旧的 Rust 2015

0.1.1 2015 年 5 月 13 日
0.1.0 2015 年 4 月 21 日

#18#again

MIT 许可证

7KB
160

tomson

Build Status

tomljson 以及再次转换回来。

文档

请在这里找到它们 这里

安装

将以下内容添加到您的 Cargo.toml

[dependencies]
tomson = "0.1.1"

Doug Tangren (softprops) 2015


lib.rs:

tomson 提供了从 TomlJson 以及从 JsonToml 的转换功能

示例

let toml = r#"
[foo]
bar = 1
"#;

let json = r#"
{"foo":{"bar":1}}
"#;

match tomson::Toml::as_json(&mut toml.to_string()) {
    Ok(json) => println!("json -> {:?}", json),
    Err(e)   => println!("invalid toml -> {:?}", e)
};

match tomson::Json::as_toml(&mut json.to_string()) {
  Ok(toml) => println!("toml -> {:?}", toml),
  Err(e)   => println!("invalid json -> {:?}", e)
};

依赖关系

~370KB