@@ -157,6 +157,7 @@ impl TextRange {
157
157
/// assert!(range.contains(start));
158
158
/// assert!(!range.contains(end));
159
159
/// ```
160
+ #[ inline]
160
161
pub fn contains ( self , offset : TextSize ) -> bool {
161
162
self . start ( ) <= offset && offset < self . end ( )
162
163
}
@@ -175,6 +176,7 @@ impl TextRange {
175
176
/// assert!(range.contains_inclusive(start));
176
177
/// assert!(range.contains_inclusive(end));
177
178
/// ```
179
+ #[ inline]
178
180
pub fn contains_inclusive ( self , offset : TextSize ) -> bool {
179
181
self . start ( ) <= offset && offset <= self . end ( )
180
182
}
@@ -194,6 +196,7 @@ impl TextRange {
194
196
/// assert!(larger.contains_range(larger));
195
197
/// assert!(smaller.contains_range(smaller));
196
198
/// ```
199
+ #[ inline]
197
200
pub fn contains_range ( self , other : TextRange ) -> bool {
198
201
self . start ( ) <= other. start ( ) && other. end ( ) <= self . end ( )
199
202
}
@@ -213,6 +216,7 @@ impl TextRange {
213
216
/// Some(TextRange::new(5.into(), 10.into())),
214
217
/// );
215
218
/// ```
219
+ #[ inline]
216
220
pub fn intersect ( self , other : TextRange ) -> Option < TextRange > {
217
221
let start = cmp:: max ( self . start ( ) , other. start ( ) ) ;
218
222
let end = cmp:: min ( self . end ( ) , other. end ( ) ) ;
@@ -236,6 +240,7 @@ impl TextRange {
236
240
/// TextRange::new(0.into(), 20.into()),
237
241
/// );
238
242
/// ```
243
+ #[ inline]
239
244
pub fn cover ( self , other : TextRange ) -> TextRange {
240
245
let start = cmp:: min ( self . start ( ) , other. start ( ) ) ;
241
246
let end = cmp:: max ( self . end ( ) , other. end ( ) ) ;
@@ -253,6 +258,7 @@ impl TextRange {
253
258
/// TextRange::new(0.into(), 20.into()),
254
259
/// )
255
260
/// ```
261
+ #[ inline]
256
262
pub fn cover_offset ( self , offset : TextSize ) -> TextRange {
257
263
self . cover ( TextRange :: empty ( offset) )
258
264
}
0 commit comments