8 releases

0.2.3 Apr 9, 2025
0.2.2 Mar 31, 2025
0.2.0 May 19, 2023
0.1.3 Mar 26, 2023
0.1.1 Jan 28, 2022

#144 in Algorithms

Download history 5612/week @ 2025-01-12 5059/week @ 2025-01-19 3492/week @ 2025-01-26 5476/week @ 2025-02-02 5095/week @ 2025-02-09 4721/week @ 2025-02-16 4801/week @ 2025-02-23 4321/week @ 2025-03-02 6844/week @ 2025-03-09 5287/week @ 2025-03-16 5176/week @ 2025-03-23 5032/week @ 2025-03-30 7003/week @ 2025-04-06 5703/week @ 2025-04-13 6201/week @ 2025-04-20 5870/week @ 2025-04-27

25,401 downloads per month
Used in 90 crates (12 directly)

MIT license

93KB
2K SLoC

dmp

The Diff Match and Patch libraries offer robust algorithms to perform the operations required for synchronising plain text. This repository contains a Rust version of the original diff-match-patch library, using up-to-date crate packages.

docs.rs Crates.io

Features

  • Diffing and patching library for plain text
  • Retrieve differences between two blocks of text
  • Create a set of patches for converting a block of text into another
  • Apply a set of patches onto a block of text to convert it to another block of text
  • Uses best-effort to apply patch even when the underlying text doesn't fully match.

Fuzzing

A fuzzer is provided as a sanity-check:

RUST_BACKTRACE=1 cargo fuzz run fuzz

Original

This code is forked originally from diff_match_patch.rs, licensed under the MIT license.

Dependencies

~0–1.5MB
~27K SLoC