@@ -141,10 +141,10 @@ public extension Offsets {
141141 distance ( from: start, to: end)
142142 }
143143
144- @inlinable @inline ( __always) func distances < T> (
145- to indices : Range < Index > , as type: T . Type = T . self) -> Range < Offset < T > > {
146- let lower : Offset < T > = distance ( from: startIndex, to: indices . lowerBound)
147- let count : Offset < T > = distance ( from: indices . lowerBound, to: indices . upperBound)
144+ @inlinable @inline ( __always) func range < T> (
145+ to positions : Range < Index > , as type: T . Type = T . self) -> Range < Offset < T > > {
146+ let lower : Offset < T > = distance ( from: /*-----*/ startIndex, to: positions . lowerBound)
147+ let count : Offset < T > = distance ( from: positions . lowerBound, to: positions . upperBound)
148148 return lower ..< lower + count
149149 }
150150
@@ -158,12 +158,12 @@ public extension Offsets {
158158 }
159159
160160 @inlinable @inline ( __always) func index< T> (
161- at distances : Offset < T > , as type: T . Type = T . self) -> Index {
162- index ( from: startIndex, move: distances )
161+ at distance : Offset < T > , as type: T . Type = T . self) -> Index {
162+ index ( from: startIndex, move: distance )
163163 }
164164
165- @inlinable @inline ( __always) func indices < T> (
166- at distances: Range < Offset < T > > , as type: T . Type = T . self) -> Range < Index > {
165+ @inlinable @inline ( __always) func range < T> (
166+ at distances: Range < Offset < T > > , as type: T . Type = T . self) -> Range < Index > {
167167 let lower = index ( from: startIndex, move: distances. lowerBound)
168168 return lower ..< index ( from: lower, move: Offset < T > ( distances. count) )
169169 }
@@ -257,13 +257,13 @@ public extension Encoding {
257257
258258 @inlinable @inline ( __always) static func distance(
259259 from start: Snapshot . Index , to end: Snapshot . Index ,
260- in collection: Snapshot ) -> Offset < Self > {
260+ in collection: Snapshot ) -> Offset < Self > {
261261 distance ( from: start. character, to: end. character, in: collection. characters)
262262 }
263263
264264 @inlinable static func index(
265265 from start: Snapshot . Index , move distance: Offset < Self > ,
266- in collection: Snapshot ) -> Snapshot . Index {
266+ in collection: Snapshot ) -> Snapshot . Index {
267267 var character = index ( from: start. character, move: distance, in: collection. characters)
268268 if character != collection. characters. endIndex {
269269 character = collection. characters. rangeOfComposedCharacterSequence ( at: character) . lowerBound
@@ -288,13 +288,13 @@ public extension Character {
288288
289289 @inlinable @inline ( __always) static func distance(
290290 from start: String . Index , to end: String . Index ,
291- in collection: some StringProtocol ) -> Offset < Self > {
291+ in collection: some StringProtocol ) -> Offset < Self > {
292292 Offset ( collection. distance ( from: start, to: end) )
293293 }
294294
295295 @inlinable @inline ( __always) static func index(
296296 from start: String . Index , move distance: Offset < Self > ,
297- in collection: some StringProtocol ) -> String . Index {
297+ in collection: some StringProtocol ) -> String . Index {
298298 collection. index ( start, offsetBy: Int ( distance) )
299299 }
300300
@@ -304,13 +304,13 @@ public extension Character {
304304
305305 @inlinable @inline ( __always) static func distance(
306306 from start: Snapshot . Index , to end: Snapshot . Index ,
307- in collection: Snapshot ) -> Offset < Self > {
307+ in collection: Snapshot ) -> Offset < Self > {
308308 Offset ( collection. distance ( from: start, to: end) )
309309 }
310310
311311 @inlinable @inline ( __always) static func index(
312312 from start: Snapshot . Index , move distance: Offset < Self > ,
313- in collection: Snapshot ) -> Snapshot . Index {
313+ in collection: Snapshot ) -> Snapshot . Index {
314314 collection. index ( start, offsetBy: Int ( distance) )
315315 }
316316}
@@ -328,13 +328,13 @@ public extension Unicode.Scalar {
328328
329329 @inlinable @inline ( __always) static func distance(
330330 from start: String . Index , to end: String . Index ,
331- in collection: some StringProtocol ) -> Offset < Self > {
331+ in collection: some StringProtocol ) -> Offset < Self > {
332332 Offset ( collection. unicodeScalars. distance ( from: start, to: end) )
333333 }
334334
335335 @inlinable @inline ( __always) static func index(
336336 from start: String . Index , move distance: Offset < Self > ,
337- in collection: some StringProtocol ) -> String . Index {
337+ in collection: some StringProtocol ) -> String . Index {
338338 collection. unicodeScalars. index ( start, offsetBy: Int ( distance) )
339339 }
340340}
@@ -352,13 +352,13 @@ public extension UTF16 {
352352
353353 @inlinable @inline ( __always) static func distance(
354354 from start: String . Index , to end: String . Index ,
355- in collection: some StringProtocol ) -> Offset < Self > {
355+ in collection: some StringProtocol ) -> Offset < Self > {
356356 Offset ( collection. utf16. distance ( from: start, to: end) )
357357 }
358358
359359 @inlinable @inline ( __always) static func index(
360360 from start: String . Index , move distance: Offset < Self > ,
361- in collection: some StringProtocol ) -> String . Index {
361+ in collection: some StringProtocol ) -> String . Index {
362362 collection. utf16. index ( start, offsetBy: Int ( distance) )
363363 }
364364}
@@ -376,13 +376,13 @@ public extension UTF8 {
376376
377377 @inlinable @inline ( __always) static func distance(
378378 from start: String . Index , to end: String . Index ,
379- in collection: some StringProtocol ) -> Offset < Self > {
379+ in collection: some StringProtocol ) -> Offset < Self > {
380380 Offset ( collection. utf8. distance ( from: start, to: end) )
381381 }
382382
383383 @inlinable @inline ( __always) static func index(
384384 from start: String . Index , move distance: Offset < Self > ,
385- in collection: some StringProtocol ) -> String . Index {
385+ in collection: some StringProtocol ) -> String . Index {
386386 collection. utf8. index ( start, offsetBy: Int ( distance) )
387387 }
388388}
0 commit comments