@@ -265,7 +265,7 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
265
265
266
266
/// Call `body(p)`, where `p` is an `UnsafeBufferPointer` over the
267
267
/// underlying contiguous storage.
268
- public func withUnsafeBufferPointer< R> (
268
+ internal func withUnsafeBufferPointer< R> (
269
269
_ body: ( UnsafeBufferPointer < Element > ) throws -> R
270
270
) rethrows -> R {
271
271
defer { _fixLifetime ( self ) }
@@ -275,7 +275,7 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
275
275
276
276
/// Call `body(p)`, where `p` is an `UnsafeMutableBufferPointer`
277
277
/// over the underlying contiguous storage.
278
- public mutating func withUnsafeMutableBufferPointer< R> (
278
+ internal mutating func withUnsafeMutableBufferPointer< R> (
279
279
_ body: ( UnsafeMutableBufferPointer < Element > ) throws -> R
280
280
) rethrows -> R {
281
281
defer { _fixLifetime ( self ) }
@@ -285,7 +285,7 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
285
285
286
286
//===--- _ArrayBufferProtocol conformance -----------------------------------===//
287
287
/// Create an empty buffer.
288
- public init ( ) {
288
+ internal init ( ) {
289
289
__bufferPointer = ManagedBufferPointer (
290
290
_uncheckedUnsafeBufferObject: _emptyArrayStorage)
291
291
}
@@ -295,7 +295,7 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
295
295
self = buffer
296
296
}
297
297
298
- public mutating func requestUniqueMutableBackingBuffer(
298
+ internal mutating func requestUniqueMutableBackingBuffer(
299
299
minimumCapacity: Int
300
300
) -> _ContiguousArrayBuffer < Element > ? {
301
301
if _fastPath ( isUniquelyReferenced ( ) && capacity >= minimumCapacity) {
@@ -304,29 +304,29 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
304
304
return nil
305
305
}
306
306
307
- public mutating func isMutableAndUniquelyReferenced( ) -> Bool {
307
+ internal mutating func isMutableAndUniquelyReferenced( ) -> Bool {
308
308
return isUniquelyReferenced ( )
309
309
}
310
310
311
- public mutating func isMutableAndUniquelyReferencedOrPinned( ) -> Bool {
311
+ internal mutating func isMutableAndUniquelyReferencedOrPinned( ) -> Bool {
312
312
return isUniquelyReferencedOrPinned ( )
313
313
}
314
314
315
315
/// If this buffer is backed by a `_ContiguousArrayBuffer`
316
316
/// containing the same number of elements as `self`, return it.
317
317
/// Otherwise, return `nil`.
318
- public func requestNativeBuffer( ) -> _ContiguousArrayBuffer < Element > ? {
318
+ internal func requestNativeBuffer( ) -> _ContiguousArrayBuffer < Element > ? {
319
319
return self
320
320
}
321
321
322
322
@_versioned
323
- func getElement( _ i: Int ) -> Element {
323
+ internal func getElement( _ i: Int ) -> Element {
324
324
_sanityCheck ( i >= 0 && i < count, " Array index out of range " )
325
325
return firstElementAddress [ i]
326
326
}
327
327
328
328
/// Get or set the value of the ith element.
329
- public subscript( i: Int ) -> Element {
329
+ internal subscript( i: Int ) -> Element {
330
330
get {
331
331
return getElement ( i)
332
332
}
@@ -344,7 +344,7 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
344
344
}
345
345
346
346
/// The number of elements the buffer stores.
347
- public var count : Int {
347
+ internal var count : Int {
348
348
get {
349
349
return __bufferPointer. header. count
350
350
}
@@ -370,15 +370,15 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
370
370
}
371
371
372
372
/// The number of elements the buffer can store without reallocation.
373
- public var capacity : Int {
373
+ internal var capacity : Int {
374
374
return __bufferPointer. header. capacity
375
375
}
376
376
377
377
/// Copy the elements in `bounds` from this buffer into uninitialized
378
378
/// memory starting at `target`. Return a pointer "past the end" of the
379
379
/// just-initialized memory.
380
380
@discardableResult
381
- public func _copyContents(
381
+ internal func _copyContents(
382
382
subRange bounds: Range < Int > ,
383
383
initializing target: UnsafeMutablePointer < Element >
384
384
) -> UnsafeMutablePointer < Element > {
@@ -525,19 +525,19 @@ extension _ContiguousArrayBuffer : RandomAccessCollection {
525
525
/// The position of the first element in a non-empty collection.
526
526
///
527
527
/// In an empty collection, `startIndex == endIndex`.
528
- public var startIndex : Int {
528
+ internal var startIndex : Int {
529
529
return 0
530
530
}
531
531
/// The collection's "past the end" position.
532
532
///
533
533
/// `endIndex` is not a valid argument to `subscript`, and is always
534
534
/// reachable from `startIndex` by zero or more applications of
535
535
/// `index(after:)`.
536
- public var endIndex : Int {
536
+ internal var endIndex : Int {
537
537
return count
538
538
}
539
539
540
- public typealias Indices = CountableRange < Int >
540
+ internal typealias Indices = CountableRange < Int >
541
541
}
542
542
543
543
extension Sequence {
@@ -578,7 +578,7 @@ extension Collection {
578
578
}
579
579
580
580
extension _ContiguousArrayBuffer {
581
- public func _copyToContiguousArray( ) -> ContiguousArray < Element > {
581
+ internal func _copyToContiguousArray( ) -> ContiguousArray < Element > {
582
582
return ContiguousArray ( _buffer: self )
583
583
}
584
584
}
0 commit comments