pub struct FileLocRange {
pub start: FileLoc,
pub end: FileLoc,
}Expand description
Half-open range [start, end) of FileLoc positions.
Direct port of upstream FileLocRange; constructors enforce
start <= end via the typed FileLocRange::new / FileLocRange::try_new
pair (upstream uses assert(Start <= End) in the constructor — the
fallible try_new makes that contract surface-visible without panicking
production code).
Fields§
§start: FileLoc§end: FileLocImplementations§
Source§impl FileLocRange
impl FileLocRange
Sourcepub const fn try_new(start: FileLoc, end: FileLoc) -> Option<Self>
pub const fn try_new(start: FileLoc, end: FileLoc) -> Option<Self>
Construct a FileLocRange from sorted endpoints.
Returns None if start > end. The upstream FileLocRange(Start, End)
constructor asserts the same invariant; we surface it as an
Option-returning constructor so callers must acknowledge the contract
without crashing on malformed inputs.
Sourcepub fn new(start: FileLoc, end: FileLoc) -> Self
pub fn new(start: FileLoc, end: FileLoc) -> Self
Construct a FileLocRange when the caller has already validated
start <= end. Mirrors upstream’s debug-asserted constructor; in
release builds the upstream form silently constructs an inverted range,
so this Rust analogue clamps to an empty range at start for the
inverted case to keep downstream invariants intact.
Sourcepub fn contains_loc(&self, loc: FileLoc) -> bool
pub fn contains_loc(&self, loc: FileLoc) -> bool
true iff loc falls inside the half-open range. Mirrors upstream
bool contains(FileLoc) const.
Sourcepub fn contains_range(&self, other: FileLocRange) -> bool
pub fn contains_range(&self, other: FileLocRange) -> bool
true iff other is fully contained. Mirrors upstream
bool contains(FileLocRange) const.
Trait Implementations§
Source§impl Clone for FileLocRange
impl Clone for FileLocRange
Source§fn clone(&self) -> FileLocRange
fn clone(&self) -> FileLocRange
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more