pub struct Hunk {
pub kind: HunkKind,
pub new_start: usize,
pub new_count: usize,
pub old_start: usize,
pub old_count: usize,
pub lines: Vec<DiffLine>,
}Expand description
One diff hunk between two versions of a file, in 1-based lines.
Fields§
§kind: HunkKind§new_start: usizeFirst affected line in the new version (1-based). For pure deletions this is the line after which content vanished.
new_count: usize§old_start: usize§old_count: usize§lines: Vec<DiffLine>Implementations§
Source§impl Hunk
impl Hunk
Sourcepub fn signs(&self) -> Vec<(usize, Sign)>
pub fn signs(&self) -> Vec<(usize, Sign)>
Signs this hunk produces, derived from its line origins.
Sourcepub fn changed_region(&self) -> (usize, usize, usize, usize)
pub fn changed_region(&self) -> (usize, usize, usize, usize)
The actual changed region (from add/del lines, not the header,
which includes context): new-side new_first/new_count
(1-based) and old-side old_first/old_count. For pure
deletions new_first is the new line following the gap.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Hunk
impl<'de> Deserialize<'de> for Hunk
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Hunk
impl StructuralPartialEq for Hunk
Auto Trait Implementations§
impl Freeze for Hunk
impl RefUnwindSafe for Hunk
impl Send for Hunk
impl Sync for Hunk
impl Unpin for Hunk
impl UnsafeUnpin for Hunk
impl UnwindSafe for Hunk
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