Skip to main content

UnifiedDiff

Struct UnifiedDiff 

Source
pub struct UnifiedDiff<'a, T, D>
where T: Hash + Eq + AsRef<[u8]>, D: ConsumeHunk,
{ /* private fields */ }
Available on crate feature blob only.
Expand description

A helper that renders a Diff as unified diff output. It can be used to create a textual diff in the format typically output by git or gnu-diff if the -u option is used.

Implementations§

Source§

impl<'a, T, D> UnifiedDiff<'a, T, D>
where T: Hash + Eq + AsRef<[u8]>, D: ConsumeHunk,

Source

pub fn new( diff: &'a Diff, input: &'a InternedInput<T>, consume_hunk: D, context_size: ContextSize, ) -> Self

Create a new instance to create a unified diff from diff using the lines in input. context_size is the amount of lines around each hunk which will be passed to consume_hunk.

consume_hunk is called for each hunk with all the information required to create a unified diff.

Source

pub fn consume(self) -> Result<D::Out>

Consume all hunks from diff and return the delegate’s final output.

Auto Trait Implementations§

§

impl<'a, T, D> Freeze for UnifiedDiff<'a, T, D>
where D: Freeze,

§

impl<'a, T, D> !RefUnwindSafe for UnifiedDiff<'a, T, D>

§

impl<'a, T, D> Send for UnifiedDiff<'a, T, D>
where D: Send, T: Sync,

§

impl<'a, T, D> Sync for UnifiedDiff<'a, T, D>
where D: Sync, T: Sync,

§

impl<'a, T, D> Unpin for UnifiedDiff<'a, T, D>
where D: Unpin,

§

impl<'a, T, D> UnsafeUnpin for UnifiedDiff<'a, T, D>
where D: UnsafeUnpin,

§

impl<'a, T, D> !UnwindSafe for UnifiedDiff<'a, T, D>

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> Same for T

Source§

type Output = T

Should always be Self
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.