Struct similar::text::UnifiedDiff[][src]

pub struct UnifiedDiff<'diff, 'old, 'new, 'bufs> { /* fields omitted */ }

Unified diff formatter.

The Display implementation renders a unified diff.

Implementations

impl<'diff, 'old, 'new, 'bufs> UnifiedDiff<'diff, 'old, 'new, 'bufs>[src]

pub fn from_text_diff(diff: &'diff TextDiff<'old, 'new, 'bufs>) -> Self[src]

Creates a formatter from a text diff object.

pub fn context_radius(&mut self, n: usize) -> &mut Self[src]

Changes the context radius.

The context radius is the number of lines between changes that should be emitted. This defaults to 3.

pub fn header(&mut self, a: &str, b: &str) -> &mut Self[src]

Sets a header to the diff.

a and b are the file names that are added to the top of the unified file format. The names are accepted verbaitim which lets you encode a timestamp into it when separated by a tab (\t). For more information see the unified diff format specification

pub fn iter_hunks(
    &self
) -> impl Iterator<Item = UnifiedDiffHunk<'diff, 'old, 'new, 'bufs>>
[src]

Iterates over all hunks as configured.

Trait Implementations

impl<'diff, 'old, 'new, 'bufs> Display for UnifiedDiff<'diff, 'old, 'new, 'bufs>[src]

Auto Trait Implementations

impl<'diff, 'old, 'new, 'bufs> RefUnwindSafe for UnifiedDiff<'diff, 'old, 'new, 'bufs>[src]

impl<'diff, 'old, 'new, 'bufs> Send for UnifiedDiff<'diff, 'old, 'new, 'bufs>[src]

impl<'diff, 'old, 'new, 'bufs> Sync for UnifiedDiff<'diff, 'old, 'new, 'bufs>[src]

impl<'diff, 'old, 'new, 'bufs> Unpin for UnifiedDiff<'diff, 'old, 'new, 'bufs> where
    'bufs: 'diff,
    'new: 'diff,
    'old: 'diff, 
[src]

impl<'diff, 'old, 'new, 'bufs> UnwindSafe for UnifiedDiff<'diff, 'old, 'new, 'bufs>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.