| Crates.io | facet-diff |
| lib.rs | facet-diff |
| version | 0.43.2 |
| created_at | 2025-06-30 16:03:02.310464+00 |
| updated_at | 2026-01-23 18:03:41.258502+00 |
| description | Structural diffing for Facet types with human-readable output - no PartialEq required |
| homepage | https://facet.rs |
| repository | https://github.com/facet-rs/facet |
| max_upload_size | |
| id | 1732047 |
| size | 401,181 |
Structural diffing for Facet types with human-readable output.
facet-diff computes differences between two values using reflection.
It works on any type that implements Facet, without requiring manual
diff implementations or PartialEq.
use facet_diff::{FacetDiff, format_diff};
let old = MyStruct { name: "alice", count: 1 };
let new = MyStruct { name: "alice", count: 2 };
let diff = old.diff(&new);
println!("{}", format_diff(&diff));
// Shows: count: 1 → 2
Facet type automaticallyuse facet_diff::FacetDiff;
let diff = old_value.diff(&new_value);
if diff.is_equal() {
println!("Values are equal");
} else {
println!("Changes detected");
}
use facet_diff::{format_diff, format_diff_compact};
// Full colored diff
let output = format_diff(&diff);
// Compact single-line format
let compact = format_diff_compact(&diff);
use facet_diff::{DiffOptions, diff_new_peek_with_options};
use facet_reflect::Peek;
let options = DiffOptions::new()
.with_float_tolerance(0.001);
let diff = diff_new_peek_with_options(
Peek::new(&old),
Peek::new(&new),
&options,
);
facet-diff uses facet-reflect to traverse values structurally:
Thanks to all individual sponsors:
...along with corporate sponsors:
...without whom this work could not exist.
The facet logo was drawn by Misiasart.
Licensed under either of:
at your option.