MCPcopy Index your code
hub / github.com/dtolnay/dissimilar

github.com/dtolnay/dissimilar @1.0.11

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.0.11 ↗ · + Follow
63 symbols 176 edges 7 files 11 documented · 17%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Dissimilar: diff library with semantic cleanup

github crates.io docs.rs build status

This library is a port of the Diff component of Diff Match Patch to Rust. The diff implementation is based on Myers' diff algorithm but includes some semantic cleanups to increase human readability by factoring out commonalities which are likely to be coincidental.

Diff Match Patch was originally built in 2006 to power Google Docs.

[dependencies]
dissimilar = "1.0"

Interface

Here is the entire API of the Rust implementation. It operates on borrowed strings and the return value of the diff algorithm is a vector of chunks pointing into slices of those input strings.

pub enum Chunk<'a> {
    Equal(&'a str),
    Delete(&'a str),
    Insert(&'a str),
}

pub fn diff(text1: &str, text2: &str) -> Vec<Chunk>;

License

The diff algorithm in this crate was ported to Rust using the Java and C++ implementations found at https://github.com/google/diff-match-patch as reference, and is made available here under the Apache License, Version 2.0 matching the license of the original. This entire project, including some parts unmodified from upstream and the Rust-specific modifications introduced in the course of porting the implementation, are distributed under this Apache license.

Intellectual property that is unique to the Rust implementation is additionally made available to you dually under the MIT license, if you prefer. This applies to all design choices and implementation choices not found in the upstream repo.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual Apache and MIT licensed, without any additional terms or conditions.

Extension points exported contracts — how you extend this code

RangeBounds (Interface)
(no doc) [4 implementers]
src/range.rs

Core symbols most depended-on inside this repo

substring
called by 31
src/range.rs
cleanup_merge
called by 17
src/lib.rs
is_empty
called by 17
src/range.rs
main
called by 16
src/lib.rs
chars
called by 14
src/range.rs
cleanup_semantic
called by 12
src/lib.rs
text
called by 10
src/lib.rs
get
called by 10
src/range.rs

Shape

Function 37
Method 21
Class 2
Enum 2
Interface 1

Languages

Rust100%

Modules by API surface

src/lib.rs27 symbols
src/range.rs17 symbols
src/tests.rs11 symbols
src/find.rs4 symbols
tests/test.rs3 symbols
benches/bench.rs1 symbols

For agents

$ claude mcp add dissimilar \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact