#diff #structure #tree #arbitrary #general

treediff

Find the difference between arbitrary data structures

17 stable releases (4 major)

4.0.2 Oct 9, 2021
4.0.0 Feb 2, 2020
3.0.2 Feb 2, 2020
3.0.1 Mar 12, 2018
0.1.0 Feb 5, 2017

#99 in Algorithms

Download history 46038/week @ 2023-02-17 45482/week @ 2023-02-24 50052/week @ 2023-03-03 54442/week @ 2023-03-10 53702/week @ 2023-03-17 50968/week @ 2023-03-24 50541/week @ 2023-03-31 50549/week @ 2023-04-07 55918/week @ 2023-04-14 51598/week @ 2023-04-21 53107/week @ 2023-04-28 57296/week @ 2023-05-05 52881/week @ 2023-05-12 55097/week @ 2023-05-19 58243/week @ 2023-05-26 68599/week @ 2023-06-02

246,739 downloads per month
Used in 8 crates (4 directly)

MIT/Apache

46KB
1K SLoC

Rust crates.io version

A library to compare arbitrary structured data of the same type, efficiently.

Please see the documentation for more details.

Usage

Add this to your Cargo.toml

[dependencies]
treediff = "4"

lib.rs:

See what's different in arbitrary data structures.

The main diff algorithm. we implement here is less than a screen full of lines, yet it enables a vast amount of applications. It can work with all values implementing the Value trait.

On top of it there is a [merge][tools::Merger] implementation, which can be used to aggregate changes into a target value. It works with Values which implement the Mutable trait.

Usage

Please have a look at the tests for diff and merge.

Also note that you will have to choose the features to build the library with in order to get trait implementations for Value types of common libraries, i.e. cargo build --features=with-serde-json.

Dependencies

~0–425KB