pub struct UnifiedDiffBuilder<'a, W, T>where
    W: Write,
    T: Hash + Eq + Display,{ /* private fields */ }
Expand description

A Sink that creates a textual diff in the format typically output by git or gnu-diff if the -u option is used

Implementations§

source§

impl<'a, T> UnifiedDiffBuilder<'a, String, T>where T: Hash + Eq + Display,

source

pub fn new(input: &'a InternedInput<T>) -> UnifiedDiffBuilder<'a, String, T>

Create a new UnifiedDiffBuilder for the given input, that will return a String.

source§

impl<'a, W, T> UnifiedDiffBuilder<'a, W, T>where W: Write, T: Hash + Eq + Display,

source

pub fn with_writer( input: &'a InternedInput<T>, writer: W ) -> UnifiedDiffBuilder<'a, W, T>

Create a new UnifiedDiffBuilder for the given input, that will writes it output to the provided implementation of Write.

Trait Implementations§

source§

impl<W, T> Sink for UnifiedDiffBuilder<'_, W, T>where W: Write, T: Hash + Eq + Display,

§

type Out = W

source§

fn process_change(&mut self, before: Range<u32>, after: Range<u32>)

This method is called whenever a diff algorithm finds a change between the two processed input file. A change is a continous subsequence of tokens before that needs to be replaced by a different contious subsequence of tokens after to construct the seconds file from the first. Read more
source§

fn finish(self) -> <UnifiedDiffBuilder<'_, W, T> as Sink>::Out

This function is called after all calls to process_change are complete to obtain the final diff result
source§

fn with_counter(self) -> Counter<Self>

Utility method that constructs a Counter that tracks the total number of inserted and removed tokens in the changes passed to process_change.

Auto Trait Implementations§

§

impl<'a, W, T> RefUnwindSafe for UnifiedDiffBuilder<'a, W, T>where T: RefUnwindSafe, W: RefUnwindSafe,

§

impl<'a, W, T> Send for UnifiedDiffBuilder<'a, W, T>where T: Sync, W: Send,

§

impl<'a, W, T> Sync for UnifiedDiffBuilder<'a, W, T>where T: Sync, W: Sync,

§

impl<'a, W, T> Unpin for UnifiedDiffBuilder<'a, W, T>where W: Unpin,

§

impl<'a, W, T> UnwindSafe for UnifiedDiffBuilder<'a, W, T>where T: RefUnwindSafe, W: UnwindSafe,

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, 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.