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>

source

pub fn new(old: Vec<&'a str>, new: Vec<&'a str>) -> LineChangeset<'a>

source

pub fn names(self, old: &'a str, new: &'a str) -> Self

Sets names for side-by-side diff

source

pub fn set_diff_only(self, val: bool) -> Self

Show only differences for side-by-side diff

source

pub fn set_show_lines(self, val: bool) -> Self

Show lines in side-by-side diff

source

pub fn set_trim_new_lines(self, val: bool) -> Self

Trim new lines in side-by-side diff

source

pub fn set_align_new_lines(self, val: bool) -> Self

Align new lines inside diff

source

pub fn diff(&self) -> Vec<DiffOp<'a, &str>>

Returns Vec of changes

source

pub fn prettytable(&self)

Prints side-by-side diff in table

source

pub fn format(&self) -> String

Returns formatted string with colors

source

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>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Display for LineChangeset<'a>

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> PartialEq<LineChangeset<'a>> for LineChangeset<'a>

source§

fn eq(&self, other: &LineChangeset<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Eq for LineChangeset<'a>

source§

impl<'a> StructuralEq for LineChangeset<'a>

source§

impl<'a> StructuralPartialEq for LineChangeset<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for LineChangeset<'a>

§

impl<'a> Send for LineChangeset<'a>

§

impl<'a> Sync for LineChangeset<'a>

§

impl<'a> Unpin for LineChangeset<'a>

§

impl<'a> UnwindSafe for LineChangeset<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.