Skip to content

Commit ea66e56

Browse files
authored
Merge pull request #5 from rust-analyzer/ctors
Add a couple of non-canonical ctors
2 parents a9a7668 + 260aa8a commit ea66e56

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/range.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ pub fn TextRange(start: TextSize, end: TextSize) -> TextRange {
5454

5555
/// Identity methods.
5656
impl TextRange {
57+
/// Creates a zero-length range at the specified offset.
58+
pub const fn empty(self, offset: TextSize) -> TextRange {
59+
TextRange {
60+
start: offset,
61+
end: offset,
62+
}
63+
}
64+
5765
/// The start point of this range.
5866
pub const fn start(self) -> TextSize {
5967
self.start

0 commit comments

Comments
 (0)