Struct libdiffsitter::diff::Hunk
source · pub struct Hunk<'a>(pub Vec<Line<'a>>);
Expand description
A grouping of consecutive edit lines for a document
Every line in a hunk must be consecutive and in ascending order.
Tuple Fields§
§0: Vec<Line<'a>>
Implementations§
source§impl<'a> Hunk<'a>
impl<'a> Hunk<'a>
sourcepub fn first_line(&self) -> Option<usize>
pub fn first_line(&self) -> Option<usize>
Returns the first line number of the hunk
This will return None if the internal vector is empty
sourcepub fn last_line(&self) -> Option<usize>
pub fn last_line(&self) -> Option<usize>
Returns the last line number of the hunk
This will return None if the internal vector is empty
sourcepub fn push_back(&mut self, entry: Entry<'a>) -> Result<(), HunkInsertionError>
pub fn push_back(&mut self, entry: Entry<'a>) -> Result<(), HunkInsertionError>
Append an entry to a hunk.
Entries can only be appended in ascending order (first to last). It is an error to append entries out of order. For example, you can’t insert an entry on line 1 after inserting an entry on line 5.
Trait Implementations§
source§impl<'a> PartialEq<Hunk<'a>> for Hunk<'a>
impl<'a> PartialEq<Hunk<'a>> for Hunk<'a>
impl<'a> Eq for Hunk<'a>
impl<'a> StructuralEq for Hunk<'a>
impl<'a> StructuralPartialEq for Hunk<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Hunk<'a>
impl<'a> !Send for Hunk<'a>
impl<'a> !Sync for Hunk<'a>
impl<'a> Unpin for Hunk<'a>
impl<'a> UnwindSafe for Hunk<'a>
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