pub struct RegionRefinement {
pub removed: Vec<Vec<Range<usize>>>,
pub added: Vec<Vec<Range<usize>>>,
}Expand description
The byte ranges that differ, per line, on each side of one hunk.
Per side, not per pair (DR.5). A hunk that removes one line and
adds twelve has no line pairing to speak of, so the two sides carry
independent per-line range lists: removed[i] describes the i-th
removed line, added[j] the j-th added one, and neither implies
the other’s length.
This replaced a Vec<Option<LineRefinement>> that was indexed by
pair. That shape could not represent n removed against m added
at all, which is why the old code declined those hunks outright
rather than rendering them badly.
Fields§
§removed: Vec<Vec<Range<usize>>>One entry per removed line, in order.
added: Vec<Vec<Range<usize>>>One entry per added line, in order.
Implementations§
Source§impl RegionRefinement
impl RegionRefinement
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
True when neither side has a single refined range — the value a declined region carries, and the one that renders exactly as it did before refinement existed.
Sourcepub fn removed_line(&self, i: usize) -> &[Range<usize>]
pub fn removed_line(&self, i: usize) -> &[Range<usize>]
Refined ranges on the i-th removed line. Empty — never a panic — for an index past the end, so a consumer walking a baseline range that outruns the refinement degrades to “no refinement here” instead of falling over.
Sourcepub fn added_line(&self, j: usize) -> &[Range<usize>]
pub fn added_line(&self, j: usize) -> &[Range<usize>]
Refined ranges on the j-th added line. Same tolerance as
Self::removed_line.
Trait Implementations§
Source§impl Clone for RegionRefinement
impl Clone for RegionRefinement
Source§fn clone(&self) -> RegionRefinement
fn clone(&self) -> RegionRefinement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RegionRefinement
impl Debug for RegionRefinement
Source§impl Default for RegionRefinement
impl Default for RegionRefinement
Source§fn default() -> RegionRefinement
fn default() -> RegionRefinement
impl Eq for RegionRefinement
Source§impl PartialEq for RegionRefinement
impl PartialEq for RegionRefinement
impl StructuralPartialEq for RegionRefinement
Auto Trait Implementations§
impl Freeze for RegionRefinement
impl RefUnwindSafe for RegionRefinement
impl Send for RegionRefinement
impl Sync for RegionRefinement
impl Unpin for RegionRefinement
impl UnsafeUnpin for RegionRefinement
impl UnwindSafe for RegionRefinement
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more