acorn-diff 0.5.3

Portable unified and JSON Patch diff primitives for ACORN
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use alloc::string::{String, ToString};
use similar::TextDiff;

/// Creates a unified line diff with three lines of context.
#[must_use]
pub fn unified_diff(before: &str, after: &str, before_label: &str, after_label: &str) -> String {
    TextDiff::from_lines(before, after)
        .unified_diff()
        .context_radius(3)
        .header(before_label, after_label)
        .to_string()
}

#[cfg(test)]
mod tests;