Struct unidiff::PatchSet [] [src]

pub struct PatchSet {
    // some fields omitted
}

Unfied patchset

You can iterate over it to get PatchedFiles.

let mut patch = PatchSet::new();
patch.parse("some diff");
for patched_file in patch {
  // do something with patched_file
  for hunk in patched_file {
      // do something with hunk
      for line in hunk {
          // do something with line
      }
  }
}

Methods

impl PatchSet
[src]

fn added_files(&self) -> Vec<PatchedFile>

Added files vector

fn removed_files(&self) -> Vec<PatchedFile>

Removed files vector

fn modified_files(&self) -> Vec<PatchedFile>

Modified files vector

fn new() -> PatchSet

Initialize a new PatchSet instance

fn with_encoding(coding: EncodingRef) -> PatchSet

Initialize a new PatchedSet instance with encoding

fn from_encoding<T: AsRef<str>>(coding: T) -> PatchSet

Initialize a new PatchedSet instance with encoding(string form)

fn parse_bytes(&mut self, input: &[u8]) -> Result<()>

Parse diff from bytes

fn parse<T: AsRef<str>>(&mut self, input: T) -> Result<()>

Parse diff from string

fn len(&self) -> usize

Count of patched files

fn is_empty(&self) -> bool

Trait Implementations

impl Clone for PatchSet
[src]

fn clone(&self) -> PatchSet

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Display for PatchSet
[src]

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

Formats the value using the given formatter.

impl IntoIterator for PatchSet
[src]

type Item = PatchedFile

The type of the elements being iterated over.

type IntoIter = IntoIter<PatchedFile>

Which kind of iterator are we turning this into?

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

impl Index<usize> for PatchSet
[src]

type Output = PatchedFile

The returned type after indexing

fn index(&self, idx: usize) -> &PatchedFile

The method for the indexing (Foo[Bar]) operation

impl IndexMut<usize> for PatchSet
[src]

fn index_mut(&mut self, index: usize) -> &mut PatchedFile

The method for the indexing (Foo[Bar]) operation