Unnamed repository; edit this file 'description' to name the repository.
Add TextRange::empty
| -rw-r--r-- | lib/text-size/src/range.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/text-size/src/range.rs b/lib/text-size/src/range.rs index 7e01b12e9f..f30b90141e 100644 --- a/lib/text-size/src/range.rs +++ b/lib/text-size/src/range.rs @@ -54,6 +54,14 @@ pub fn TextRange(start: TextSize, end: TextSize) -> TextRange { /// Identity methods. impl TextRange { + /// Creates a zero-length range at the specified offset. + pub const fn empty(self, offset: TextSize) -> TextRange { + TextRange { + start: offset, + end: offset, + } + } + /// The start point of this range. pub const fn start(self) -> TextSize { self.start |