[−][src]Struct unidiff::Hunk
Each of the modified blocks of a file
You can iterate over it to get Lines.
Fields
source_start: usizeSource file starting line number
source_length: usizeSource file changes length
target_start: usizeTarget file starting line number
target_length: usizeTarget file changes length
section_header: StringSection header
Methods
impl Hunk[src]
pub fn new<T: Into<String>>(
source_start: usize,
source_length: usize,
target_start: usize,
target_length: usize,
section_header: T
) -> Hunk[src]
source_start: usize,
source_length: usize,
target_start: usize,
target_length: usize,
section_header: T
) -> Hunk
pub fn added(&self) -> usize[src]
Count of lines added
pub fn removed(&self) -> usize[src]
Count of lines removed
pub fn is_valid(&self) -> bool[src]
Is this hunk valid
pub fn source_lines(&self) -> Vec<Line>[src]
Lines from source file
pub fn target_lines(&self) -> Vec<Line>[src]
Lines from target file
pub fn append(&mut self, line: Line)[src]
Append new line into hunk
pub fn len(&self) -> usize[src]
Count of lines in this hunk
pub fn is_empty(&self) -> bool[src]
Is this hunk empty
pub fn lines(&self) -> &[Line][src]
Lines in this hunk
pub fn lines_mut(&mut self) -> &mut [Line][src]
Trait Implementations
impl Clone for Hunk[src]
impl Debug for Hunk[src]
impl Display for Hunk[src]
impl Eq for Hunk[src]
impl Hash for Hunk[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl Index<usize> for Hunk[src]
impl IndexMut<usize> for Hunk[src]
impl IntoIterator for Hunk[src]
type Item = Line
The type of the elements being iterated over.
type IntoIter = IntoIter<Line>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter[src]
impl PartialEq<Hunk> for Hunk[src]
impl StructuralEq for Hunk[src]
impl StructuralPartialEq for Hunk[src]
Auto Trait Implementations
impl RefUnwindSafe for Hunk
impl Send for Hunk
impl Sync for Hunk
impl Unpin for Hunk
impl UnwindSafe for Hunk
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>,