[][src]Struct unidiff::PatchSet

pub struct PatchSet { /* fields omitted */ }

Unfied patchset

You can iterate over it to get PatchedFiles.

This example is not tested
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]

pub fn added_files(&self) -> Vec<PatchedFile>[src]

Added files vector

pub fn removed_files(&self) -> Vec<PatchedFile>[src]

Removed files vector

pub fn modified_files(&self) -> Vec<PatchedFile>[src]

Modified files vector

pub fn new() -> PatchSet[src]

Initialize a new PatchSet instance

pub fn with_encoding(coding: &'static Encoding) -> PatchSet[src]

Initialize a new PatchedSet instance with encoding

pub fn from_encoding<T: AsRef<str>>(coding: T) -> PatchSet[src]

Initialize a new PatchedSet instance with encoding(string form)

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

Parse diff from bytes

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

Parse diff from string

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

Count of patched files

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

pub fn files(&self) -> &[PatchedFile][src]

Files in this patch set

pub fn files_mut(&mut self) -> &mut [PatchedFile][src]

Trait Implementations

impl Clone for PatchSet[src]

impl Debug for PatchSet[src]

impl Default for PatchSet[src]

impl Display for PatchSet[src]

impl FromStr for PatchSet[src]

type Err = Error

The associated error which can be returned from parsing.

impl Index<usize> for PatchSet[src]

type Output = PatchedFile

The returned type after indexing.

impl IndexMut<usize> for PatchSet[src]

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?

Auto Trait Implementations

impl RefUnwindSafe for PatchSet

impl Send for PatchSet

impl Sync for PatchSet

impl Unpin for PatchSet

impl UnwindSafe for PatchSet

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.