MCPcopy Create free account
hub / github.com/distil/diffus / diff

Method diff

diffus/src/diffable_impls/string.rs:9–24  ·  view source on GitHub ↗
(&'a self, other: &'a Self)

Source from the content-addressed store, hash-verified

7 type Diff = Vec<string::Edit>;
8
9 fn diff(&'a self, other: &'a Self) -> edit::Edit<Self> {
10 let s = lcs::lcs(
11 || self.chars(),
12 || other.chars(),
13 self.chars().count(),
14 other.chars().count(),
15 )
16 .map(Into::into)
17 .collect::<Vec<_>>();
18
19 if s.iter().all(string::Edit::is_copy) {
20 edit::Edit::Copy(self)
21 } else {
22 edit::Edit::Change(s)
23 }
24 }
25}
26
27impl<'a> Diffable<'a> for String {

Callers 2

stringFunction · 0.45
strFunction · 0.45

Calls 1

lcsFunction · 0.85

Tested by 2

stringFunction · 0.36
strFunction · 0.36