pub struct RangeMatch {
pub source: TextRange,
pub destination: TextRange,
pub operation: TextOperation,
}Expand description
A textual range match. For a given source match, it provides the operation for that range and optionally the matching range on the destination side.
Note that it doesn’t use before or after terms on purpose, because it is used for both before-to-after and after-to-before ranges.
Fields§
§source: TextRange§destination: TextRange§operation: TextOperationImplementations§
Source§impl RangeMatch
impl RangeMatch
pub fn zero() -> Self
pub fn is_zero(&self) -> bool
Sourcepub fn extends(
&self,
other: &RangeMatch,
source_code: &SourceText<'_>,
dest_code: &SourceText<'_>,
) -> bool
pub fn extends( &self, other: &RangeMatch, source_code: &SourceText<'_>, dest_code: &SourceText<'_>, ) -> bool
Takes a SourceText per side rather than a &str, because deciding this needs to look
at the text between two ranges, which means turning row/column positions into byte
offsets - and doing that by walking the file was 90% of the corpus’s worst fixture. See
SourceText’s own doc comment for the measurement. Callers build one per side per call to
ranges, not one per comparison.
pub fn extend_into(&mut self, other: &RangeMatch)
Trait Implementations§
Source§impl Clone for RangeMatch
impl Clone for RangeMatch
Source§fn clone(&self) -> RangeMatch
fn clone(&self) -> RangeMatch
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 RangeMatch
impl Debug for RangeMatch
Source§impl PartialEq for RangeMatch
impl PartialEq for RangeMatch
impl StructuralPartialEq for RangeMatch
Auto Trait Implementations§
impl Freeze for RangeMatch
impl RefUnwindSafe for RangeMatch
impl Send for RangeMatch
impl Sync for RangeMatch
impl Unpin for RangeMatch
impl UnsafeUnpin for RangeMatch
impl UnwindSafe for RangeMatch
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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> ⓘ
Converts
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> ⓘ
Converts
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