Skip to content

Commit a951d3c

Browse files
committed
stdlib: mark APIs on internal types as internal
1 parent 60efdd0 commit a951d3c

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
}
@@ -126,7 +126,7 @@ extension _ArrayBuffer {
126126
/// `_ContiguousArrayBuffer` that can be grown in-place to allow the self
127127
/// buffer store minimumCapacity elements, returns that buffer.
128128
/// Otherwise, returns `nil`.
129-
public mutating func requestUniqueMutableBackingBuffer(minimumCapacity: Int)
129+
internal mutating func requestUniqueMutableBackingBuffer(minimumCapacity: Int)
130130
-> NativeBuffer? {
131131
if _fastPath(isUniquelyReferenced()) {
132132
let b = _native
@@ -137,18 +137,18 @@ extension _ArrayBuffer {
137137
return nil
138138
}
139139

140-
public mutating func isMutableAndUniquelyReferenced() -> Bool {
140+
internal mutating func isMutableAndUniquelyReferenced() -> Bool {
141141
return isUniquelyReferenced()
142142
}
143143

144-
public mutating func isMutableAndUniquelyReferencedOrPinned() -> Bool {
144+
internal mutating func isMutableAndUniquelyReferencedOrPinned() -> Bool {
145145
return isUniquelyReferencedOrPinned()
146146
}
147147

148148
/// If this buffer is backed by a `_ContiguousArrayBuffer`
149149
/// containing the same number of elements as `self`, return it.
150150
/// Otherwise, return `nil`.
151-
public func requestNativeBuffer() -> NativeBuffer? {
151+
internal func requestNativeBuffer() -> NativeBuffer? {
152152
if !_isClassOrObjCExistential(Element.self) {
153153
return _native
154154
}
@@ -467,8 +467,8 @@ extension _ArrayBuffer {
467467
public typealias Indices = CountableRange<Int>
468468

469469
//===--- private --------------------------------------------------------===//
470-
typealias Storage = _ContiguousArrayStorage<Element>
471-
public typealias NativeBuffer = _ContiguousArrayBuffer<Element>
470+
internal typealias Storage = _ContiguousArrayStorage<Element>
471+
internal typealias NativeBuffer = _ContiguousArrayBuffer<Element>
472472

473473
@_versioned
474474
var _isNative: Bool {

stdlib/public/core/ContiguousArrayBuffer.swift

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

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

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

285285
//===--- _ArrayBufferProtocol conformance -----------------------------------===//
286286
/// Create an empty buffer.
287-
public init() {
287+
internal init() {
288288
__bufferPointer = ManagedBufferPointer(
289289
_uncheckedUnsafeBufferObject: _emptyArrayStorage)
290290
}
@@ -294,7 +294,7 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
294294
self = buffer
295295
}
296296

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

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

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

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

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

327327
/// Get or set the value of the ith element.
328-
public subscript(i: Int) -> Element {
328+
internal subscript(i: Int) -> Element {
329329
get {
330330
return getElement(i)
331331
}
@@ -343,7 +343,7 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
343343
}
344344

345345
/// The number of elements the buffer stores.
346-
public var count: Int {
346+
internal var count: Int {
347347
get {
348348
return __bufferPointer.header.count
349349
}
@@ -369,15 +369,15 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
369369
}
370370

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

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

543-
public typealias Indices = CountableRange<Int>
543+
internal typealias Indices = CountableRange<Int>
544544
}
545545

546546
extension Sequence {
@@ -581,7 +581,7 @@ extension Collection {
581581
}
582582

583583
extension _ContiguousArrayBuffer {
584-
public func _copyToContiguousArray() -> ContiguousArray<Element> {
584+
internal func _copyToContiguousArray() -> ContiguousArray<Element> {
585585
return ContiguousArray(_buffer: self)
586586
}
587587
}

0 commit comments

Comments
 (0)