Struct prettydiff::text::LineChangeset
source · pub struct LineChangeset<'a> { /* private fields */ }
Expand description
Container for line-by-line text diff result. Can be pretty-printed by Display trait.
Implementations§
source§impl<'a> LineChangeset<'a>
impl<'a> LineChangeset<'a>
pub fn new(old: Vec<&'a str>, new: Vec<&'a str>) -> LineChangeset<'a>
sourcepub fn set_diff_only(self, val: bool) -> Self
pub fn set_diff_only(self, val: bool) -> Self
Show only differences for side-by-side diff
sourcepub fn set_show_lines(self, val: bool) -> Self
pub fn set_show_lines(self, val: bool) -> Self
Show lines in side-by-side diff
sourcepub fn set_trim_new_lines(self, val: bool) -> Self
pub fn set_trim_new_lines(self, val: bool) -> Self
Trim new lines in side-by-side diff
sourcepub fn set_align_new_lines(self, val: bool) -> Self
pub fn set_align_new_lines(self, val: bool) -> Self
Align new lines inside diff
sourcepub fn prettytable(&self)
pub fn prettytable(&self)
Prints side-by-side diff in table
sourcepub fn format_with_context(
&self,
context_config: Option<ContextConfig<'_>>,
display_line_numbers: bool
) -> String
pub fn format_with_context( &self, context_config: Option<ContextConfig<'_>>, display_line_numbers: bool ) -> String
Returns formatted string with colors.
May omit identical lines, if context_size
is Some(k)
.
In this case, only print identical lines if they are within k
lines
of a changed line (as in diff -C
).
Trait Implementations§
source§impl<'a> Debug for LineChangeset<'a>
impl<'a> Debug for LineChangeset<'a>
source§impl<'a> Display for LineChangeset<'a>
impl<'a> Display for LineChangeset<'a>
source§impl<'a> PartialEq<LineChangeset<'a>> for LineChangeset<'a>
impl<'a> PartialEq<LineChangeset<'a>> for LineChangeset<'a>
source§fn eq(&self, other: &LineChangeset<'a>) -> bool
fn eq(&self, other: &LineChangeset<'a>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.