[−][src]Struct unidiff::PatchSet
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.
fn from_str(s: &str) -> Result<Self>[src]
impl Index<usize> for PatchSet[src]
type Output = PatchedFile
The returned type after indexing.
fn index(&self, idx: usize) -> &PatchedFile[src]
impl IndexMut<usize> for PatchSet[src]
fn index_mut(&mut self, index: usize) -> &mut PatchedFile[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?
fn into_iter(self) -> Self::IntoIter[src]
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator, [src]
I: Iterator,
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?
fn into_iter(self) -> I[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,