diff_to_string

Function diff_to_string 

Source
pub fn diff_to_string<'mem, 'facet>(
    from: &'mem impl Facet<'facet>,
    to: &'mem impl Facet<'facet>,
    diff: &Diff<'mem, 'facet>,
) -> String
Expand description

Render a diff as XML to a String with ANSI colors.

§Arguments

  • from - The original value
  • to - The new value
  • diff - The diff between from and to

§Example

use facet_diff::FacetDiff;

let old = Point { x: 10, y: 20 };
let new = Point { x: 15, y: 20 };
let diff = old.diff(&new);

let xml = facet_xml::diff_to_string(&old, &new, &diff);
println!("{}", xml);