Merge Struct
============

[github](https://github.com/jondot/merge-struct)
[crates.io](https://crates.io/crates/merge-struct)
[docs.rs](https://docs.rs/merge-struct)
[build status](https://github.com/jondot/merge-struct/actions?query=branch%3Amaster)

This is a Rust library deep merges two serializable structs.

## Dependency

```toml
[dependencies]
merge-struct = "0.1.0"
```

For most recent version see [crates.io](https://crates.io/crates/merge-struct)


## Usage

```rust
use std::collections::BTreeMap;
use serde_json;
use serde::{Deserialize, Serialize};
use merge_struct::merge;

let left: Data = serde_json::from_str(
    r###"
{
    "is_root": false,
    "entries": {
        "/var/log/f2": {
            "name":"f2",
            "size": 5
        }
    },
    "folders": [
        {
            "name": "/var/log",
            "num_files": 20
        }
    ]
}
"###,
)
.unwrap();

let right: Data = serde_json::from_str(
    r###"
{
    "folders":[],
    "entries": {
        "/var/log/f1": {
            "name":"f1",
            "size": 12
        }
    }
}
"###,
).unwrap();

let res = merge(&left, &right);
```


# Copyright

Copyright (c) 2022 [@jondot](http://twitter.com/jondot). See [LICENSE](LICENSE.txt) for further details.
