19 stable releases (5 major)

5.0.0 Mar 27, 2024
4.0.3 Feb 3, 2024
4.0.2 Oct 9, 2021
4.0.0 Feb 2, 2020
0.1.0 Feb 5, 2017

#44 in Algorithms

Download history 109505/week @ 2024-07-19 102441/week @ 2024-07-26 95085/week @ 2024-08-02 100290/week @ 2024-08-09 101150/week @ 2024-08-16 115174/week @ 2024-08-23 99141/week @ 2024-08-30 100638/week @ 2024-09-06 81780/week @ 2024-09-13 97312/week @ 2024-09-20 103382/week @ 2024-09-27 82936/week @ 2024-10-04 97795/week @ 2024-10-11 101255/week @ 2024-10-18 98804/week @ 2024-10-25 91479/week @ 2024-11-01

407,444 downloads per month
Used in 12 crates (7 directly)

MIT/Apache

47KB
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 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–0.9MB
~17K SLoC