// the find
mitsuhiko/similar
A high level diffing library for rust based on diffs
similar is a Rust diffing library that implements Myers, Patience, Histogram, Hunt, and LCS algorithms with a clean high-level API over all of them. It's the engine behind mitsuhiko's insta snapshot testing tool, so it's battle-tested in a real production use case. If you need to produce diffs in Rust — unified patches, inline word-level diffs, arbitrary sequence comparison — this is the library to reach for.
Five diff algorithms in one crate with a unified API, so you can swap between Myers and Patience without rewriting your consumer code. Grapheme-aware text diffing is genuinely useful and often missing from simpler diff libraries. no_std + alloc support with a feature flag is well thought out, including a hashbrown backend option for performance in constrained environments. The snapshot tests are the library's own output verified against itself via insta, which means regressions in diff output are caught automatically.
1282 stars and 48 forks for a library that's been around this long suggests limited adoption outside the insta ecosystem — not a sign of a problem with the code, but worth noting if community momentum matters to you. The API for custom sequence diffing requires implementing a trait and wiring up hooks, which is more ceremony than you'd expect for simple use cases. No built-in three-way merge support — if you need conflict detection or merge resolution, you'll need to build it yourself on top of the primitives. Documentation is solid but the examples lean heavily on text diffing; using the algorithms on non-string types takes more reading than it should.