similar
A diff library for Rust
3.2.0
181M downloads/mo
#544 most downloaded on crates.io
mitsuhiko/similar
What this package is like to depend on
Last release 6 days ago
17 Aug 2026
Release timing varies
gaps range from 9 days to 1.2 years
Nearly every release is documented
notes for 25 of 25 stable releases
Nothing withdrawn
no release was ever pulled
6 years old
25 releases · first in 2021
5 releases in the last 12 months
see the full history below
Release timeline
25 releases · Jan 2021 to Aug 2026
2022
2023
2024
2025
2026
Releases
latest 25-
3.2.017 Aug 2026Release notes
Open source →- Added structured, line-oriented three-way merging through
TextMerge, with merge and diff3 conflict output, configurable labels and marker sizes, owned and borrowed inputs, byte output, and whitespace-insensitive comparison. - Added
WhitespaceModeandTextDiffConfig::whitespace_modefor Git-style line comparisons that ignore changes in whitespace (-b) or all whitespace (-w). - Changed
Algorithm::Myersto reduce unmatched/confusing records and use Git-style bounded, non-minimal splits on expensive searches, and addedAlgorithm::RawMyersfor the previous shortest-edit-script behavior without output-changing heuristics. - Improved heuristics and performance for most algorithms other than LCS.
- Improved large-input performance by avoiding quadratic Histogram scans.
- Added structured, line-oriented three-way merging through
-
3.1.204 Aug 2026Release notes
Open source →- Fixed
Algorithm::Lcsdeadline fallback emitting edits twice, which produced out-of-boundsDiffOpranges and panics when consuming timed-out diffs. #97 - Fixed
Algorithm::Lcsreporting identical subranges with zero-based indices instead of preserving the supplied range offsets. #98 - Fixed
Algorithm::LcsandAlgorithm::Huntemitting zero-length delete operations when both inputs are empty. #99
- Fixed
-
3.1.123 May 2026Release notes
Open source →- Fixed
DiffOpcursor positions when compacting adjacent inserts/deletes and inAlgorithm::Histogramfull-replacement output, ensuring operations form contiguous ranges. #95 - Renamed sample diff input files to a lexicographic
caseNN.01.before_*/caseNN.02.after_*scheme.
- Fixed
-
3.1.011 Apr 2026Release notes
Open source →- Added
capture_diff_slices_by_keyandcapture_diff_slices_by_key_deadlineas convenience helpers for diffing slices by derived keys. - Fixed
Compactemitting inconsistentDiffOpcursor positions after compaction, which could leaveDelete/Insertoperations with stalenew_index/old_indexvalues. - Added explicit lifetime capture (
+ use<...>) on iterator-returning APIs to improve compatibility with Rust 2024 lifetime capture behavior. #93
- Added
-
3.0.001 Apr 2026Release notes
Open source →- Added a Git-style Histogram diff implementation exposed as
Algorithm::Histogram, including deadline-aware Myers fallback and comprehensive regression/behavior tests. - Raised MSRV to Rust 1.85 and moved the crate to Rust 2024 edition.
- Added a Hunt-style diff implementation exposed as
Algorithm::Hunt. - Added configurable inline refinement via
InlineChangeOptionsandInlineChangeMode, including semantic cleanup and newTextDiff::iter_inline_changes_with_options*methods. #92 - Added a global disjoint-input fast path in
algorithms::diff_deadlineto avoid pathological runtimes on large, fully distinct inputs. - Improved
Algorithm::Myersperformance on heavily unbalanced diffs to avoid pathological slowdowns. - Added
diff_deadline_rawentrypoints in the algorithm modules to bypass shared heuristics and keep minimal intrinsic trait bounds where needed. - Added test files in
examples/diffsthat can be used with the some of the examples as input pairs. - Added
CachedLookup, a helper for adapting virtual or computed sequences by materializing items on first access and then serving borrowed values through normal indexing. Theowned-lookupexample demonstrates this approach for issue #33. - Fixed ranged indexing in the classic LCS table algorithm.
- Improved diff compaction to merge adjacent delete hunks across equal runs.
- Excluded development scripts from published crate contents. #87
TextDiff::from_*andTextDiffConfig::diff_*now accept owned inputs (String,Vec<u8>,Cow) in addition to borrowed inputs. This allows returning text diffs from functions without external owner lifetimes. #65TextDiffno longer exposesold_slices/new_slices. Useold_len,new_len,old_slice,new_slice,iter_old_slices,iter_new_slices,old_lookup, andnew_lookupinstead.TextDiff::iter_changesnow panics on invalid out-of-boundsDiffOpranges instead of silently truncating iteration.utils::diff_lines_inlinenow takes&TextDiffand options rather than(Algorithm, old, new, options).utils::diff_linesnow avoids a second line-tokenization pass.- Renamed
get_diff_ratiotodiff_ratio. - Added first-class
no_std + allocsupport with an explicit defaultstdfeature. - Added optional
hashbrownbackend forno_stdmap storage (default-features = false, features = ["hashbrown"]), while the defaultno_stdbackend usesalloc::collections::BTreeMap. - Made core constructors const-ready (
Capture::new,Replace::new,NoFinishHook::new,InlineChangeOptions::new,TextDiff::configure).
- Added a Git-style Histogram diff implementation exposed as
-
2.7.019 Jan 2025Release notes
Open source →- Add optional support for
web-timeto support web WASM targets. #73 - Crate will no longer panic wheh deadlines are used in WASM. At worst
deadlines are silently ignored. To enforce deadlines enable the
wasm32_web_timefeature. #74
- Add optional support for
-
2.6.021 Jul 2024 -
2.5.028 Mar 2024Release notes
Open source →- Added support for
TextDiff::iter_inline_changes_deadline. #61 - Raise MSRV to 1.60. #62
- Bump bstr dependency to 1.0. #62
- Added support for
-
2.4.029 Dec 2023Release notes
Open source →- Fixed a bug where the LCS diff algorithm didn't always call
D::finish. (#58) - Fixed a bug in LCS that caused a panic if the common prefix and the common suffix overlapped. (#59)
- Fixed a bug where the LCS diff algorithm didn't always call
-
2.3.007 Oct 2023 -
2.2.114 Nov 2022 -
2.2.001 Aug 2022 -
2.1.003 Oct 2021Release notes
Open source →- Removed deprecated alternative slice diffing functions.
- Added
serdefeature to allow serialization with serde.
-
2.0.011 Sep 2021Release notes
Open source →- Change the
Changetype and associated methods to work on anyT: Cloneinstead of&T. This makes theiter_changesmethod also work on slices of integers or other values.
- Change the
-
1.3.025 Feb 2021Release notes
Open source →- Performance improvements for the LCS algorithm.
- Small performance improvements by adding an early opt-out for and inline highlighting.
- Added
IdentifyDistinctto convert sequences to ints. - Small performance improvements for larger text diffs by using
IdentifyDistinctautomatically above a threshold. - Added deadlines to all diffing algorithms to bail early.
- Deprecated slice diffing methods in the individual algorithm modules.
- Use a default timeout for the inline highlighting feature.
- Added a compacting step to clean up diffs. This results in nicer looking diffs and
fewer edits. This is happening automatically for captured diffs and is exposed
through the
Capturetype. - Fix incorrect ranges in unified diff output.
-
1.2.215 Feb 2021 -
1.2.115 Feb 2021 -
1.2.015 Feb 2021Release notes
Open source →- Make the unicode feature optional for inline diffing.
- Added Hunt–McIlroy LCS algorithm (
lcs). - Changed the implementation of Mayer's diff. This has slightly changed the behavior but resulted in significantly improved performance and more readable code.
- Added
NoFinishHookto aid composing of diff hooks.
-
1.1.006 Feb 2021Release notes
Open source →- More generic lifetimes for
iter_changesanditer_inline_changes. - Added
iter_all_changesshortcut as this is commonly useful. - Added
iter_slicestoDiffOpto quickly get an iterator over the encoded slices rather than individual items likeiter_changesdoes. - Added the
utilsmodule with various text diffing utilities. - Added
TextDiffRemapperwhich helps with working with the original, preTextDifftokenization slices.
- More generic lifetimes for
-
1.0.003 Feb 2021Release notes
Open source →- Add
get_diff_ratio. - Add support for byte diffing and change the text interface to abstract
over
DiffableStr. - Restructured crate layout greatly. Text diffing is now on the crate root, some functionality remains in the algorithms.
- The
Changetype now also works for non text diffs.
- Add
-
0.5.001 Feb 2021Release notes
Open source →- Add
DiffOp::apply_to_hookto apply a captured op to a diff hook. - Added missing newline handling to the
Changestype. - Made unified diff support more flexible through the introduction of
the
UnifiedDifftype. - Fixed grouped diff operation to return an empty result if the diff does not show any changes.
- Added inline diff highlighting support.
- Changed word splitting to split into words and whitespace.
- Added support for unicode based word splitting (
TextDiff::from_unicode_words).
- Add
-
0.4.030 Jan 2021Release notes
Open source →- Change
get_close_matchesto use Python's quick ratio optimization and order lexicographically when tied.
- Change
-
0.3.024 Jan 2021Release notes
Open source →- Added grapheme and character level diffing utilities.
DiffOp::as_tag_tupleis now taking the argument by reference.- Added
TextDiff::ratio. - Added
get_close_matches.
-
0.2.024 Jan 2021 -
0.1.024 Jan 2021