pub struct FileDiffLines {
pub added_lines: Vec<u32>,
pub added_ranges: Vec<Range<u32>>,
pub diff_hunks: Vec<Range<u32>>,
}file-changes only.Expand description
A structure to represent a file’s changes per line numbers.
Fields§
§added_lines: Vec<u32>The list of lines numbers with additions.
added_ranges: Vec<Range<u32>>The list of ranges that span only lines numbers with additions.
The line numbers here disregard the old line numbers in the diff hunks. Each range describes the beginning and ending of a group of consecutive line numbers.
diff_hunks: Vec<Range<u32>>The list of ranges that span the lines numbers present in diff chunks.
The line numbers here disregard the old line numbers in the diff hunks.
Implementations§
Source§impl FileDiffLines
impl FileDiffLines
Sourcepub fn with_info(added_lines: Vec<u32>, diff_chunks: Vec<Range<u32>>) -> Self
pub fn with_info(added_lines: Vec<u32>, diff_chunks: Vec<Range<u32>>) -> Self
Instantiate an object with changed lines information.
Sourcepub fn get_ranges(
&self,
lines_changed_only: &LinesChangedOnly,
) -> Option<Vec<Range<u32>>>
pub fn get_ranges( &self, lines_changed_only: &LinesChangedOnly, ) -> Option<Vec<Range<u32>>>
Get the ranges of changed lines based on the lines_changed_only parameter.
Use this to map Self::added_lines and Self::diff_hunks to a selection of
LinesChangedOnly options.
Sourcepub fn is_hunk_in_diff(&self, hunk: &DiffHunkHeader) -> Option<(u32, u32)>
pub fn is_hunk_in_diff(&self, hunk: &DiffHunkHeader) -> Option<(u32, u32)>
Is the range from DiffHunkHeader contained in a single item of
FileDiffLines::diff_hunks?
Sourcepub fn is_line_in_diff(&self, line: &u32) -> bool
pub fn is_line_in_diff(&self, line: &u32) -> bool
Similar to FileDiffLines::is_hunk_in_diff() but looks for a single line instead of
all lines in a DiffHunkHeader.
Trait Implementations§
Source§impl Clone for FileDiffLines
impl Clone for FileDiffLines
Source§fn clone(&self) -> FileDiffLines
fn clone(&self) -> FileDiffLines
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more