Skip to content

rems-project/diffable-rs

Repository files navigation

diffable-rs

A no-std compatible Rust library for uniform diffing of data structures, macros for deriving diffable implementations, and Debug-like printers for printing out diffs.

## Example

let s1 = S {
    a: BTreeMap::from([(0, "hello"), (1, "world")]),
    b: true,
    c: vec![E::A, E::B(17), E::B(42)],
};

let s2 = S {
    a: BTreeMap::from([(1, "worldly"), (2, "again")]),
    b: false,
    c: vec![E::B(17), E::B(42), E::A],
};

let diff = s1.diff(&s2);
assert_eq!(
  format!("{}", diff),
  stringify!(
DiffS {a: {0: "hello", 1: "worldly", 2: "again"}, b: false, c: [.0: B(17), .1: B(42), .2: A    ]}
              +++++++     ---------     -------      -----          -----        --       -----
                          "world"                    true           A            17       B(42)
                          +++++++                    ++++           +            ++       +++++
  )
);

See the examples directory for more usages.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages