Skip to content

Commit 11b7e9a

Browse files
committed
stdlib: mark APIs on internal types as internal
1 parent 3c741ba commit 11b7e9a

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

stdlib/public/core/ArrayBuffer.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ internal typealias _ArrayBridgeStorage
2525
internal struct _ArrayBuffer<Element> : _ArrayBufferProtocol {
2626

2727
/// Create an empty buffer.
28-
public init() {
28+
internal init() {
2929
_storage = _ArrayBridgeStorage(native: _emptyArrayStorage)
3030
}
3131

32-
public init(nsArray: _NSArrayCore) {
32+
internal init(nsArray: _NSArrayCore) {
3333
_sanityCheck(_isClassOrObjCExistential(Element.self))
3434
_storage = _ArrayBridgeStorage(objC: nsArray)
3535
}
@@ -121,7 +121,7 @@ extension _ArrayBuffer {
121121
/// `_ContiguousArrayBuffer` that can be grown in-place to allow the self
122122
/// buffer store minimumCapacity elements, returns that buffer.
123123
/// Otherwise, returns `nil`.
124-
public mutating func requestUniqueMutableBackingBuffer(minimumCapacity: Int)
124+
internal mutating func requestUniqueMutableBackingBuffer(minimumCapacity: Int)
125125
-> NativeBuffer? {
126126
if _fastPath(isUniquelyReferenced()) {
127127
let b = _native
@@ -132,18 +132,18 @@ extension _ArrayBuffer {
132132
return nil
133133
}
134134

135-
public mutating func isMutableAndUniquelyReferenced() -> Bool {
135+
internal mutating func isMutableAndUniquelyReferenced() -> Bool {
136136
return isUniquelyReferenced()
137137
}
138138

139-
public mutating func isMutableAndUniquelyReferencedOrPinned() -> Bool {
139+
internal mutating func isMutableAndUniquelyReferencedOrPinned() -> Bool {
140140
return isUniquelyReferencedOrPinned()
141141
}
142142

143143
/// If this buffer is backed by a `_ContiguousArrayBuffer`
144144
/// containing the same number of elements as `self`, return it.
145145
/// Otherwise, return `nil`.
146-
public func requestNativeBuffer() -> NativeBuffer? {
146+
internal func requestNativeBuffer() -> NativeBuffer? {
147147
if !_isClassOrObjCExistential(Element.self) {
148148
return _native
149149
}
@@ -466,8 +466,8 @@ extension _ArrayBuffer {
466466
public typealias Indices = CountableRange<Int>
467467

468468
//===--- private --------------------------------------------------------===//
469-
typealias Storage = _ContiguousArrayStorage<Element>
470-
public typealias NativeBuffer = _ContiguousArrayBuffer<Element>
469+
internal typealias Storage = _ContiguousArrayStorage<Element>
470+
internal typealias NativeBuffer = _ContiguousArrayBuffer<Element>
471471

472472
@_versioned
473473
var _isNative: Bool {

stdlib/public/core/ContiguousArrayBuffer.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
265265

266266
/// Call `body(p)`, where `p` is an `UnsafeBufferPointer` over the
267267
/// underlying contiguous storage.
268-
public func withUnsafeBufferPointer<R>(
268+
internal func withUnsafeBufferPointer<R>(
269269
_ body: (UnsafeBufferPointer<Element>) throws -> R
270270
) rethrows -> R {
271271
defer { _fixLifetime(self) }
@@ -275,7 +275,7 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
275275

276276
/// Call `body(p)`, where `p` is an `UnsafeMutableBufferPointer`
277277
/// over the underlying contiguous storage.
278-
public mutating func withUnsafeMutableBufferPointer<R>(
278+
internal mutating func withUnsafeMutableBufferPointer<R>(
279279
_ body: (UnsafeMutableBufferPointer<Element>) throws -> R
280280
) rethrows -> R {
281281
defer { _fixLifetime(self) }
@@ -285,7 +285,7 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
285285

286286
//===--- _ArrayBufferProtocol conformance -----------------------------------===//
287287
/// Create an empty buffer.
288-
public init() {
288+
internal init() {
289289
__bufferPointer = ManagedBufferPointer(
290290
_uncheckedUnsafeBufferObject: _emptyArrayStorage)
291291
}
@@ -295,7 +295,7 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
295295
self = buffer
296296
}
297297

298-
public mutating func requestUniqueMutableBackingBuffer(
298+
internal mutating func requestUniqueMutableBackingBuffer(
299299
minimumCapacity: Int
300300
) -> _ContiguousArrayBuffer<Element>? {
301301
if _fastPath(isUniquelyReferenced() && capacity >= minimumCapacity) {
@@ -304,29 +304,29 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
304304
return nil
305305
}
306306

307-
public mutating func isMutableAndUniquelyReferenced() -> Bool {
307+
internal mutating func isMutableAndUniquelyReferenced() -> Bool {
308308
return isUniquelyReferenced()
309309
}
310310

311-
public mutating func isMutableAndUniquelyReferencedOrPinned() -> Bool {
311+
internal mutating func isMutableAndUniquelyReferencedOrPinned() -> Bool {
312312
return isUniquelyReferencedOrPinned()
313313
}
314314

315315
/// If this buffer is backed by a `_ContiguousArrayBuffer`
316316
/// containing the same number of elements as `self`, return it.
317317
/// Otherwise, return `nil`.
318-
public func requestNativeBuffer() -> _ContiguousArrayBuffer<Element>? {
318+
internal func requestNativeBuffer() -> _ContiguousArrayBuffer<Element>? {
319319
return self
320320
}
321321

322322
@_versioned
323-
func getElement(_ i: Int) -> Element {
323+
internal func getElement(_ i: Int) -> Element {
324324
_sanityCheck(i >= 0 && i < count, "Array index out of range")
325325
return firstElementAddress[i]
326326
}
327327

328328
/// Get or set the value of the ith element.
329-
public subscript(i: Int) -> Element {
329+
internal subscript(i: Int) -> Element {
330330
get {
331331
return getElement(i)
332332
}
@@ -344,7 +344,7 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
344344
}
345345

346346
/// The number of elements the buffer stores.
347-
public var count: Int {
347+
internal var count: Int {
348348
get {
349349
return __bufferPointer.header.count
350350
}
@@ -370,15 +370,15 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
370370
}
371371

372372
/// The number of elements the buffer can store without reallocation.
373-
public var capacity: Int {
373+
internal var capacity: Int {
374374
return __bufferPointer.header.capacity
375375
}
376376

377377
/// Copy the elements in `bounds` from this buffer into uninitialized
378378
/// memory starting at `target`. Return a pointer "past the end" of the
379379
/// just-initialized memory.
380380
@discardableResult
381-
public func _copyContents(
381+
internal func _copyContents(
382382
subRange bounds: Range<Int>,
383383
initializing target: UnsafeMutablePointer<Element>
384384
) -> UnsafeMutablePointer<Element> {
@@ -525,19 +525,19 @@ extension _ContiguousArrayBuffer : RandomAccessCollection {
525525
/// The position of the first element in a non-empty collection.
526526
///
527527
/// In an empty collection, `startIndex == endIndex`.
528-
public var startIndex: Int {
528+
internal var startIndex: Int {
529529
return 0
530530
}
531531
/// The collection's "past the end" position.
532532
///
533533
/// `endIndex` is not a valid argument to `subscript`, and is always
534534
/// reachable from `startIndex` by zero or more applications of
535535
/// `index(after:)`.
536-
public var endIndex: Int {
536+
internal var endIndex: Int {
537537
return count
538538
}
539539

540-
public typealias Indices = CountableRange<Int>
540+
internal typealias Indices = CountableRange<Int>
541541
}
542542

543543
extension Sequence {
@@ -578,7 +578,7 @@ extension Collection {
578578
}
579579

580580
extension _ContiguousArrayBuffer {
581-
public func _copyToContiguousArray() -> ContiguousArray<Element> {
581+
internal func _copyToContiguousArray() -> ContiguousArray<Element> {
582582
return ContiguousArray(_buffer: self)
583583
}
584584
}

0 commit comments

Comments
 (0)