Skip to content

Merge your toml configurations in rust

Notifications You must be signed in to change notification settings

jdrouet/serde-toml-merge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
}

About

Merge your toml configurations in rust

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages