pub struct Hunk {
pub before: Range<u32>,
pub after: Range<u32>,
}
Expand description
A single change in a Diff
that represents a range of tokens (before
)
in the first sequence that were replaced by a diffrerent range of tokens
in the second sequence (after
).
Tokens that are a
Fields§
§before: Range<u32>
§after: Range<u32>
Implementations§
Source§impl Hunk
impl Hunk
Sourcepub const NONE: Hunk
pub const NONE: Hunk
Can be used instead of Option::None
for better performance.
Because imara-diff
does not support more then i32::MAX
there is an unused bit pattern that can be used.
Has some nice properties where it usually is not necessary to check for None
seperatly:
Empty ranges fail contains checks and also faills smaller then checks.
Sourcepub fn invert(&self) -> Hunk
pub fn invert(&self) -> Hunk
Inverts a hunk so that it represents a change that would undo this hunk.
Sourcepub fn is_pure_insertion(&self) -> bool
pub fn is_pure_insertion(&self) -> bool
Returns whether tokens are only inserted and not removed in this hunk.
Sourcepub fn is_pure_removal(&self) -> bool
pub fn is_pure_removal(&self) -> bool
Returns whether tokens are only removed and not remved in this hunk.
Trait Implementations§
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 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