serde-toml-merge

Crates.ioserde-toml-merge
lib.rsserde-toml-merge
version0.3.8
sourcesrc
created_at2021-11-25 10:40:48.869987
updated_at2024-06-04 04:50:08.114584
descriptionMerge your toml values.
homepage
repositoryhttps://github.com/jdrouet/serde-toml-merge
max_upload_size
id487522
size10,840
Jérémie Drouet (jdrouet)

documentation

README

Serde Toml Merge

codecov

Just like serde_merge, this crate allows you to merge toml values.

How to use

use serde_toml_merge::merge;
use toml::Value;

fn main() {
    let first = r#"
string = "foo"
integer = 42
float = 42.24
boolean = true
keep_me = true
"#
    .parse::<Value>()
    .unwrap();

    let second = r#"
string = "bar"
integer = 43
float = 24.42
boolean = false
missing = true
"#
    .parse::<Value>()
    .unwrap();

    let expected = r#"
string = "bar"
integer = 43
float = 24.42
boolean = false
keep_me = true
missing = true
"#
    .parse::<Value>()
    .unwrap();

    assert_eq!(merge(first, second).unwrap(), expected);
}
Commit count: 60

cargo fmt