@@ -89,31 +89,17 @@ AdditiveArithmetic, ExpressibleByIntegerLiteral {
8989}
9090
9191//*============================================================================*
92- // MARK: * Offset x Int
92+ // MARK: * Offset x Int [...]
9393//*============================================================================*
9494
95- public extension Int {
96-
97- //=------------------------------------------------------------------------=
98- // MARK: Initializers
99- //=------------------------------------------------------------------------=
100-
101- @inlinable @inline ( __always)
102- init < T> ( _ offset: Offset < T > ) {
103- self = offset. distance
104- }
105- }
95+ public extension Int { @inlinable init < T> ( _ offset: Offset < T > ) { self = offset. distance } }
10696
10797//*============================================================================*
108- // MARK: * Offsets
98+ // MARK: * Offsets [...]
10999//*============================================================================*
110100
111101public protocol Offsets < Index> : Collection {
112102
113- //=------------------------------------------------------------------------=
114- // MARK: Utilities
115- //=------------------------------------------------------------------------=
116-
117103 @inlinable @inline ( __always) func distance< T> (
118104 from start: Index , to end: Index ) -> Offset < T >
119105
@@ -122,15 +108,11 @@ public protocol Offsets<Index>: Collection {
122108}
123109
124110//=----------------------------------------------------------------------------=
125- // MARK: + Details
111+ // MARK: + Details [...]
126112//=----------------------------------------------------------------------------=
127113
128114public extension Offsets {
129115
130- //=------------------------------------------------------------------------=
131- // MARK: Utilities
132- //=------------------------------------------------------------------------=
133-
134116 @inlinable @inline ( __always) func distance< T> (
135117 from start: Index , to end: Index , as type: T . Type ) -> Offset < T > {
136118 distance ( from: start, to: end)
@@ -143,10 +125,6 @@ public extension Offsets {
143125 return lower ..< lower + count
144126 }
145127
146- //=------------------------------------------------------------------------=
147- // MARK: Utilities
148- //=------------------------------------------------------------------------=
149-
150128 @inlinable @inline ( __always) func index< T> (
151129 from start: Index , move distance: Offset < T > , as type: T . Type ) -> Index {
152130 index ( from: start, move: distance)
@@ -165,17 +143,13 @@ public extension Offsets {
165143}
166144
167145//*============================================================================*
168- // MARK: * Offsets x String, String.SubSequence
146+ // MARK: * Offsets x String, String.SubSequence [...]
169147//*============================================================================*
170148
171149extension String : Offsets { }
172150extension String . SubSequence : Offsets { }
173151public extension StringProtocol {
174152
175- //=------------------------------------------------------------------------=
176- // MARK: Utilities
177- //=------------------------------------------------------------------------=
178-
179153 @inlinable @inline ( __always) func distance< T> (
180154 from start: Index , to end: Index ) -> Offset < T > {
181155 T . distance ( from: start, to: end, in: self )
@@ -188,16 +162,12 @@ public extension StringProtocol {
188162}
189163
190164//*============================================================================*
191- // MARK: * Offsets x Snapshot
165+ // MARK: * Offsets x Snapshot [...]
192166//*============================================================================*
193167
194168extension Snapshot : Offsets { }
195169public extension Snapshot {
196170
197- //=------------------------------------------------------------------------=
198- // MARK: Utilities
199- //=------------------------------------------------------------------------=
200-
201171 @inlinable @inline ( __always) func distance< T> (
202172 from start: Index , to end: Index ) -> Offset < T > {
203173 T . distance ( from: start, to: end, in: self )
@@ -210,15 +180,11 @@ public extension Snapshot {
210180}
211181
212182//*============================================================================*
213- // MARK: * Encoding
183+ // MARK: * Encoding [...]
214184//*============================================================================*
215185
216186public protocol Encoding {
217187
218- //=------------------------------------------------------------------------=
219- // MARK: Utilities
220- //=------------------------------------------------------------------------=
221-
222188 @inlinable @inline ( __always) static func distance(
223189 from start: String . Index , to end: String . Index ,
224190 in collection: some StringProtocol ) -> Offset < Self >
@@ -227,10 +193,6 @@ public protocol Encoding {
227193 from start: String . Index , move distance: Offset < Self > ,
228194 in collection: some StringProtocol ) -> String . Index
229195
230- //=------------------------------------------------------------------------=
231- // MARK: Utilities
232- //=------------------------------------------------------------------------=
233-
234196 @inlinable @inline ( __always) static func distance(
235197 from start: Snapshot . Index , to end: Snapshot . Index ,
236198 in collection: Snapshot ) -> Offset < Self >
@@ -241,15 +203,11 @@ public protocol Encoding {
241203}
242204
243205//=----------------------------------------------------------------------------=
244- // MARK: + Details
206+ // MARK: + Details [...]
245207//=----------------------------------------------------------------------------=
246208
247209public extension Encoding {
248210
249- //=------------------------------------------------------------------------=
250- // MARK: Utilities
251- //=------------------------------------------------------------------------=
252-
253211 @inlinable @inline ( __always) static func distance(
254212 from start: Snapshot . Index , to end: Snapshot . Index ,
255213 in collection: Snapshot ) -> Offset < Self > {
@@ -271,16 +229,12 @@ public extension Encoding {
271229}
272230
273231//*============================================================================*
274- // MARK: * Encoding x Character
232+ // MARK: * Encoding x Character [...]
275233//*============================================================================*
276234
277235extension Character : Encoding { }
278236public extension Character {
279237
280- //=------------------------------------------------------------------------=
281- // MARK: Utilities
282- //=------------------------------------------------------------------------=
283-
284238 @inlinable @inline ( __always) static func distance(
285239 from start: String . Index , to end: String . Index ,
286240 in collection: some StringProtocol ) -> Offset < Self > {
@@ -293,10 +247,6 @@ public extension Character {
293247 collection. index ( start, offsetBy: Int ( distance) )
294248 }
295249
296- //=------------------------------------------------------------------------=
297- // MARK: Utilities
298- //=------------------------------------------------------------------------=
299-
300250 @inlinable @inline ( __always) static func distance(
301251 from start: Snapshot . Index , to end: Snapshot . Index ,
302252 in collection: Snapshot ) -> Offset < Self > {
@@ -311,16 +261,12 @@ public extension Character {
311261}
312262
313263//*============================================================================*
314- // MARK: * Encoding x Unicode.Scalar
264+ // MARK: * Encoding x Unicode.Scalar [...]
315265//*============================================================================*
316266
317267extension Unicode . Scalar : Encoding { }
318268public extension Unicode . Scalar {
319269
320- //=------------------------------------------------------------------------=
321- // MARK: Utilities
322- //=------------------------------------------------------------------------=
323-
324270 @inlinable @inline ( __always) static func distance(
325271 from start: String . Index , to end: String . Index ,
326272 in collection: some StringProtocol ) -> Offset < Self > {
@@ -335,16 +281,12 @@ public extension Unicode.Scalar {
335281}
336282
337283//*============================================================================*
338- // MARK: * Encoding x UTF16
284+ // MARK: * Encoding x UTF16 [...]
339285//*============================================================================*
340286
341287extension UTF16 : Encoding { }
342288public extension UTF16 {
343289
344- //=------------------------------------------------------------------------=
345- // MARK: Utilities
346- //=------------------------------------------------------------------------=
347-
348290 @inlinable @inline ( __always) static func distance(
349291 from start: String . Index , to end: String . Index ,
350292 in collection: some StringProtocol ) -> Offset < Self > {
@@ -359,16 +301,12 @@ public extension UTF16 {
359301}
360302
361303//*============================================================================*
362- // MARK: * Encoding x UTF8
304+ // MARK: * Encoding x UTF8 [...]
363305//*============================================================================*
364306
365307extension UTF8 : Encoding { }
366308public extension UTF8 {
367309
368- //=------------------------------------------------------------------------=
369- // MARK: Utilities
370- //=------------------------------------------------------------------------=
371-
372310 @inlinable @inline ( __always) static func distance(
373311 from start: String . Index , to end: String . Index ,
374312 in collection: some StringProtocol ) -> Offset < Self > {
0 commit comments