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.