pub struct FileDiffLines {
pub added_lines: Vec<u32>,
pub added_ranges: Vec<Range<u32>>,
pub diff_hunks: Vec<Range<u32>>,
}Available on crate feature
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.
pub fn get_ranges( &self, lines_changed_only: &LinesChangedOnly, ) -> Option<Vec<Range<u32>>>
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
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FileDiffLines
impl Debug for FileDiffLines
Source§impl Default for FileDiffLines
impl Default for FileDiffLines
Source§fn default() -> FileDiffLines
fn default() -> FileDiffLines
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FileDiffLines
impl RefUnwindSafe for FileDiffLines
impl Send for FileDiffLines
impl Sync for FileDiffLines
impl Unpin for FileDiffLines
impl UnwindSafe for FileDiffLines
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more