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

Function lcs_post_change

diffus/src/lcs.rs:152–163  ·  view source on GitHub ↗

FIXME move out from lcs

(
    result: impl Iterator<Item = Edit<&'a T>>,
)

Source from the content-addressed store, hash-verified

150
151// FIXME move out from lcs
152pub(crate) fn lcs_post_change<'a, T: Same + Diffable<'a> + ?Sized + 'a>(
153 result: impl Iterator<Item = Edit<&'a T>>,
154) -> impl Iterator<Item = edit::collection::Edit<'a, T, <T as Diffable<'a>>::Diff>> {
155 result.map(|edit| match edit {
156 Edit::Same(left, right) => match left.diff(right) {
157 edit::Edit::Copy(t) => edit::collection::Edit::Copy(t),
158 edit::Edit::Change(diff) => edit::collection::Edit::Change(diff),
159 },
160 Edit::Insert(value) => edit::collection::Edit::Insert(value),
161 Edit::Remove(value) => edit::collection::Edit::Remove(value),
162 })
163}
164
165#[cfg(test)]
166mod tests {

Callers

nothing calls this directly

Calls 1

diffMethod · 0.45

Tested by

no test coverage detected