mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 11:20:54 +00:00
Improve doc
This commit is contained in:
parent
1cf74802ab
commit
369e430b05
@ -214,7 +214,9 @@ impl LineIndex {
|
|||||||
Some(LineCol { line: line_col.line, col })
|
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> + '_ {
|
pub fn lines(&self, range: TextRange) -> impl Iterator<Item = TextRange> + '_ {
|
||||||
let lo = self.newlines.partition_point(|&it| it < range.start());
|
let lo = self.newlines.partition_point(|&it| it < range.start());
|
||||||
let hi = self.newlines.partition_point(|&it| it <= range.end());
|
let hi = self.newlines.partition_point(|&it| it <= range.end());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user