[][src]Struct unidiff::PatchedFile

pub struct PatchedFile {
    pub source_file: String,
    pub source_timestamp: Option<String>,
    pub target_file: String,
    pub target_timestamp: Option<String>,
    // some fields omitted
}

Patch updated file, contains a list of Hunks

You can iterate over it to get Hunks.

Fields

source_file: String

Source file name

source_timestamp: Option<String>

Source file timestamp

target_file: String

Target file name

target_timestamp: Option<String>

Target file timestamp

Methods

impl PatchedFile[src]

pub fn new<T: Into<String>>(source_file: T, target_file: T) -> PatchedFile[src]

Initialize a new PatchedFile instance

pub fn with_hunks<T: Into<String>>(
    source_file: T,
    target_file: T,
    hunks: Vec<Hunk>
) -> PatchedFile
[src]

Initialize a new PatchedFile instance with hunks

pub fn path(&self) -> String[src]

Patched file relative path

pub fn added(&self) -> usize[src]

Count of lines added

pub fn removed(&self) -> usize[src]

Count of lines removed

pub fn is_added_file(&self) -> bool[src]

Is this file newly added

pub fn is_removed_file(&self) -> bool[src]

Is this file removed

pub fn is_modified_file(&self) -> bool[src]

Is this file modified

pub fn len(&self) -> usize[src]

Count of hunks

pub fn is_empty(&self) -> bool[src]

pub fn hunks(&self) -> &[Hunk][src]

Hunks in this file

pub fn hunks_mut(&mut self) -> &mut [Hunk][src]

Trait Implementations

impl Clone for PatchedFile[src]

impl Debug for PatchedFile[src]

impl Display for PatchedFile[src]

impl Eq for PatchedFile[src]

impl Hash for PatchedFile[src]

impl Index<usize> for PatchedFile[src]

type Output = Hunk

The returned type after indexing.

impl IndexMut<usize> for PatchedFile[src]

impl IntoIterator for PatchedFile[src]

type Item = Hunk

The type of the elements being iterated over.

type IntoIter = IntoIter<Hunk>

Which kind of iterator are we turning this into?

impl PartialEq<PatchedFile> for PatchedFile[src]

impl StructuralEq for PatchedFile[src]

impl StructuralPartialEq for PatchedFile[src]

Auto Trait Implementations

impl RefUnwindSafe for PatchedFile

impl Send for PatchedFile

impl Sync for PatchedFile

impl Unpin for PatchedFile

impl UnwindSafe for PatchedFile

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<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.