pub struct DrawDiff<'a> { /* private fields */ }Expand description
The struct that draws the diff
Uses similar under the hood
Implementations§
source§impl<'input> DrawDiff<'input>
impl<'input> DrawDiff<'input>
sourcepub fn new<'a>(old: &'a str, new: &'a str, theme: &'a dyn Theme) -> DrawDiff<'a>
pub fn new<'a>(old: &'a str, new: &'a str, theme: &'a dyn Theme) -> DrawDiff<'a>
Make a new instance of the diff drawer
Examples
use termdiff::{ArrowsTheme, DrawDiff};
let theme = ArrowsTheme::default();
assert_eq!(
format!(
"{}",
DrawDiff::new(
"The quick brown fox and\njumps over the sleepy dog",
"The quick red fox and\njumps over the lazy dog",
&theme
)
),
"< left / > right
<The quick brown fox and
<jumps over the sleepy dog
>The quick red fox and
>jumps over the lazy dog
"
);