Struct unidiff::PatchedFile
[−]
[src]
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 Hunk
s.
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]
source_file: T,
target_file: T,
hunks: Vec<Hunk>
) -> PatchedFile
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]
Trait Implementations
impl Debug for PatchedFile
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Clone for PatchedFile
[src]
fn clone(&self) -> PatchedFile
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for PatchedFile
[src]
fn eq(&self, __arg_0: &PatchedFile) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &PatchedFile) -> bool
[src]
This method tests for !=
.
impl Eq for PatchedFile
[src]
impl Hash for PatchedFile
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Display for PatchedFile
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
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?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl Index<usize> for PatchedFile
[src]
type Output = Hunk
The returned type after indexing.
fn index(&self, idx: usize) -> &Hunk
[src]
Performs the indexing (container[index]
) operation.