Struct similar::udiff::UnifiedDiffHunk

source ·
pub struct UnifiedDiffHunk<'diff, 'old, 'new, 'bufs, T: DiffableStr + ?Sized> { /* private fields */ }
Expand description

Unified diff hunk formatter.

The Display this renders out a single unified diff’s hunk.

Implementations§

source§

impl<'diff, 'old, 'new, 'bufs, T: DiffableStr + ?Sized> UnifiedDiffHunk<'diff, 'old, 'new, 'bufs, T>

source

pub fn new( ops: Vec<DiffOp>, diff: &'diff TextDiff<'old, 'new, 'bufs, T>, missing_newline_hint: bool, ) -> UnifiedDiffHunk<'diff, 'old, 'new, 'bufs, T>

Creates a new hunk for some operations.

source

pub fn header(&self) -> UnifiedHunkHeader

Returns the header for the hunk.

source

pub fn ops(&self) -> &[DiffOp]

Returns all operations in the hunk.

source

pub fn missing_newline_hint(&self) -> bool

Returns the value of the missing_newline_hint flag.

source

pub fn iter_changes<'x, 'slf>(&'slf self) -> AllChangesIter<'slf, 'x, T>
where 'x: 'slf + 'old + 'new, 'old: 'x, 'new: 'x,

Iterates over all changes in a hunk.

source

pub fn to_writer<W: Write>(&self, w: W) -> Result<(), Error>
where 'diff: 'old + 'new + 'bufs,

Write the hunk as bytes to the output stream.

Trait Implementations§

source§

impl<'diff, 'old, 'new, 'bufs, T: DiffableStr + ?Sized> Display for UnifiedDiffHunk<'diff, 'old, 'new, 'bufs, T>
where 'diff: 'old + 'new + 'bufs,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'diff, 'old, 'new, 'bufs, T> Freeze for UnifiedDiffHunk<'diff, 'old, 'new, 'bufs, T>
where T: ?Sized,

§

impl<'diff, 'old, 'new, 'bufs, T> RefUnwindSafe for UnifiedDiffHunk<'diff, 'old, 'new, 'bufs, T>
where T: RefUnwindSafe + ?Sized,

§

impl<'diff, 'old, 'new, 'bufs, T> Send for UnifiedDiffHunk<'diff, 'old, 'new, 'bufs, T>
where T: Sync + ?Sized,

§

impl<'diff, 'old, 'new, 'bufs, T> Sync for UnifiedDiffHunk<'diff, 'old, 'new, 'bufs, T>
where T: Sync + ?Sized,

§

impl<'diff, 'old, 'new, 'bufs, T> Unpin for UnifiedDiffHunk<'diff, 'old, 'new, 'bufs, T>
where T: ?Sized,

§

impl<'diff, 'old, 'new, 'bufs, T> UnwindSafe for UnifiedDiffHunk<'diff, 'old, 'new, 'bufs, T>
where T: RefUnwindSafe + ?Sized,

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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

§

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.