@@ -32,12 +32,12 @@ extension Sequence {
3232 }
3333}
3434
35+ /// A wrapper that strides over a base sequence or collection.
3536public struct Stride < Base: Sequence > {
37+ internal let base : Base
38+ internal let stride : Int
3639
37- let base : Base
38- let stride : Int
39-
40- init ( base: Base , stride: Int ) {
40+ internal init ( base: Base , stride: Int ) {
4141 precondition ( stride > 0 , " striding must be greater than zero " )
4242 self . base = base
4343 self . stride = stride
@@ -51,12 +51,11 @@ extension Stride {
5151}
5252
5353extension Stride : Sequence {
54-
54+ /// An iterator over a `Stride` sequence.
5555 public struct Iterator : IteratorProtocol {
56-
57- var iterator : Base . Iterator
58- let stride : Int
59- var striding : Bool = false
56+ internal var iterator : Base . Iterator
57+ internal let stride : Int
58+ internal var striding : Bool = false
6059
6160 public mutating func next( ) -> Base . Element ? {
6261 guard striding else {
@@ -76,12 +75,11 @@ extension Stride: Sequence {
7675}
7776
7877extension Stride : Collection where Base: Collection {
79-
78+ /// A position in a `Stride` collection.
8079 public struct Index : Comparable {
80+ internal let base : Base . Index
8181
82- let base : Base . Index
83-
84- init ( _ base: Base . Index ) {
82+ internal init ( _ base: Base . Index ) {
8583 self . base = base
8684 }
8785
@@ -192,29 +190,21 @@ extension Stride: BidirectionalCollection
192190 }
193191}
194192
195- extension Stride : RandomAccessCollection
196- where Base: RandomAccessCollection { }
193+ extension Stride : RandomAccessCollection where Base: RandomAccessCollection { }
197194
198- extension Stride : Equatable
199- where Base. Element: Equatable {
200-
195+ extension Stride : Equatable where Base. Element: Equatable {
201196 public static func == ( lhs: Stride , rhs: Stride ) -> Bool {
202197 lhs. elementsEqual ( rhs, by: == )
203198 }
204-
205199}
206200
207- extension Stride : Hashable
208- where Base. Element: Hashable {
209-
201+ extension Stride : Hashable where Base. Element: Hashable {
210202 public func hash( into hasher: inout Hasher ) {
211203 hasher. combine ( stride)
212204 for element in self {
213205 hasher. combine ( element)
214206 }
215207 }
216-
217208}
218209
219- extension Stride . Index : Hashable
220- where Base. Index: Hashable { }
210+ extension Stride . Index : Hashable where Base. Index: Hashable { }
0 commit comments