diff options
| author | Ariel Davis <ariel.z.davis@icloud.com> | 2023-05-06 15:42:15 -0700 |
|---|---|---|
| committer | Ariel Davis <ariel.z.davis@icloud.com> | 2023-05-06 15:42:15 -0700 |
| commit | 369e430b05534e694183b6faa8e4e0e540973158 (patch) | |
| tree | cafd9a2179a04258342d59dbde579064533aa2c9 /lib | |
| parent | 1cf74802ab111085a2137a2188892ef5d8641b0b (diff) | |
| download | rust-369e430b05534e694183b6faa8e4e0e540973158.tar.gz rust-369e430b05534e694183b6faa8e4e0e540973158.zip | |
Improve doc
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/line-index/src/lib.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/line-index/src/lib.rs b/lib/line-index/src/lib.rs index 2c71e8e7632..23f9d989c0c 100644 --- a/lib/line-index/src/lib.rs +++ b/lib/line-index/src/lib.rs @@ -214,7 +214,9 @@ impl LineIndex { Some(LineCol { line: line_col.line, col }) } - /// Returns an iterator over the ranges for the lines. + /// Given a range [start, end), returns a sorted iterator of non-empty ranges [start, x1), [x1, + /// x2), ..., [xn, end) where all the xi, which are positions of newlines, are inside the range + /// [start, end). pub fn lines(&self, range: TextRange) -> impl Iterator<Item = TextRange> + '_ { let lo = self.newlines.partition_point(|&it| it < range.start()); let hi = self.newlines.partition_point(|&it| it <= range.end()); |
