gix_diff::blob

Struct UnifiedDiffBuilder

source
pub struct UnifiedDiffBuilder<'a, W, T>
where W: Write, T: Hash + Eq + Display,
{ /* private fields */ }
Available on crate feature blob only.
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,

source§

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> Freeze for UnifiedDiffBuilder<'a, W, T>
where W: Freeze,

§

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

§

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

§

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

§

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

§

impl<'a, W, T> UnwindSafe for UnifiedDiffBuilder<'a, W, T>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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 T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

source§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.