pub struct Region {
pub start: Loc,
pub end: Loc,
}Expand description
The location enclosed by a region begins at start and ends exclusively
at end. It is required that both locations come from the same source and
that end monotonically proceeds start (so start and end can compare
equal). This invariant is enforced when constructing through
Region::new.
Fields§
§start: LocAn inclusive lower bound (see Loc::partial_cmp) on the region
enclosed.
end: LocAn exclusive upper bound (see Loc::partial_cmp) on the region
enclosed.
Implementations§
Source§impl Region
impl Region
Sourcepub fn unit(start: Loc) -> Region
pub fn unit(start: Loc) -> Region
A region at start of length 1.
Requires: the start.line contains at least one more character after
start.col.
pub fn start_line(&self) -> isize
pub fn end_line(&self) -> isize
Sourcepub fn find_intersection(
&self,
lines: &[String],
start_line: isize,
) -> Vec<LineSection>
pub fn find_intersection( &self, lines: &[String], start_line: isize, ) -> Vec<LineSection>
Given a set of complete lines from the same source as source()
and the line number of the first line in lines, start_line, this
function computes the intersection of this region and the given
lines. If the output vector is non-empty, the first entry in the output
vector corresponds to the first line of this region, which is not
necessarily the first line in lines. See LineSection.