Struct unidiff::Hunk
[−]
[src]
pub struct Hunk { pub source_start: usize, pub source_length: usize, pub target_start: usize, pub target_length: usize, pub section_header: String, // some fields omitted }
Each of the modified blocks of a file
You can iterate over it to get Line
s.
Fields
source_start: usize
Source file starting line number
source_length: usize
Source file changes length
target_start: usize
Target file starting line number
target_length: usize
Target file changes length
section_header: String
Section 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
Trait Implementations
impl Debug for Hunk
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Clone for Hunk
[src]
fn clone(&self) -> Hunk
[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 Hunk
[src]
fn eq(&self, __arg_0: &Hunk) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Hunk) -> bool
[src]
This method tests for !=
.
impl Eq for Hunk
[src]
impl Hash for Hunk
[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 Hunk
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
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]
Creates an iterator from a value. Read more
impl Index<usize> for Hunk
[src]
type Output = Line
The returned type after indexing.
fn index(&self, idx: usize) -> &Line
[src]
Performs the indexing (container[index]
) operation.