mirror of
https://github.com/apple/swift-collections
synced 2026-11-28 05:04:21 +00:00
Renaming BorrowingSequence_ to Iterable_
This commit is contained in:
1 parent
232e6aeacf
commit
4bda43f4a9
53 files changed
+197
-197
No files matched your search
@@ -349,7 +349,7 @@ extension RigidArray {
|
||||
#if compiler(>=6.4) && UnstableContainersPreview
|
||||
@inlinable
|
||||
internal mutating func _append<
|
||||
Source: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
Source: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying newElements: borrowing Source
|
||||
) {
|
||||
@@ -371,7 +371,7 @@ extension RigidArray {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func append<
|
||||
Source: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
Source: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying newElements: borrowing Source
|
||||
) {
|
||||
@@ -413,7 +413,7 @@ extension RigidArray {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func append<
|
||||
Source: BorrowingSequence_<Element> & Sequence<Element>
|
||||
Source: Iterable_<Element> & Sequence<Element>
|
||||
>(copying newElements: Source) {
|
||||
_append(copying: newElements)
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@ import ContainersPreview
|
||||
|
||||
#if compiler(>=6.4) && UnstableContainersPreview
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray: BorrowingSequence_ where Element: ~Copyable {
|
||||
public typealias BorrowingIterator_ = SpanIterator<Element>
|
||||
extension RigidArray: Iterable_ where Element: ~Copyable {
|
||||
public typealias IterableIterator_ = SpanIterator<Element>
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func makeBorrowingIterator_() -> BorrowingIterator_ {
|
||||
public func makeIterableIterator_() -> IterableIterator_ {
|
||||
SpanIterator(self.span)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
/// The container must not contain more than `capacity` elements.
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<Source: BorrowingSequence_<Element> & ~Copyable & ~Escapable>(
|
||||
public init<Source: Iterable_<Element> & ~Copyable & ~Escapable>(
|
||||
capacity: Int,
|
||||
copying contents: borrowing Source
|
||||
) {
|
||||
@@ -145,7 +145,7 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
/// The container must not contain more than `capacity` elements.
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<Source: BorrowingSequence_<Element> & Sequence<Element>>(
|
||||
public init<Source: Iterable_<Element> & Sequence<Element>>(
|
||||
capacity: Int,
|
||||
copying contents: Source
|
||||
) {
|
||||
|
||||
@@ -415,7 +415,7 @@ extension RigidArray {
|
||||
copying items: borrowing C,
|
||||
newCount: Int
|
||||
) {
|
||||
var it = items.makeBorrowingIterator_()
|
||||
var it = items.makeIterableIterator_()
|
||||
insert(addingCount: newCount, at: index) { target in
|
||||
while !target.isFull {
|
||||
let source = it.nextSpan_(maximumCount: target.freeCapacity)
|
||||
|
||||
@@ -591,7 +591,7 @@ extension RigidArray {
|
||||
copyingContainer items: borrowing C,
|
||||
newCount: Int
|
||||
) {
|
||||
var it = items.makeBorrowingIterator_()
|
||||
var it = items.makeIterableIterator_()
|
||||
self.replace(removing: subrange, addingCount: newCount) { target in
|
||||
while !target.isFull {
|
||||
let source = it.nextSpan_(maximumCount: target.freeCapacity)
|
||||
|
||||
@@ -41,14 +41,14 @@ extension RigidDictionary where Key: ~Copyable, Value: ~Copyable {
|
||||
}
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension RigidDictionary.Indices: BorrowingSequence_
|
||||
extension RigidDictionary.Indices: Iterable_
|
||||
where Key: ~Copyable, Value: ~Copyable
|
||||
{
|
||||
public typealias Element = RigidDictionary.Index
|
||||
public typealias Element_ = Element
|
||||
|
||||
@frozen
|
||||
public struct BorrowingIterator_: ~Escapable {
|
||||
public struct IterableIterator_: ~Escapable {
|
||||
public typealias Element = RigidDictionary.Index
|
||||
|
||||
@usableFromInline
|
||||
@@ -71,16 +71,16 @@ where Key: ~Copyable, Value: ~Copyable
|
||||
public var underestimatedCount_: Int { self._base.value.count }
|
||||
|
||||
@_lifetime(borrow self) // FIXME: Should be @_lifetime(copy self)
|
||||
public func makeBorrowingIterator_() -> BorrowingIterator_ {
|
||||
public func makeIterableIterator_() -> IterableIterator_ {
|
||||
let bit = self._base.value.makeBucketIterator()
|
||||
// FIXME: This override really should not be necessary. Check if the real `struct Borrow` fixes it.
|
||||
let override = _overrideLifetime(bit, copying: self)
|
||||
return BorrowingIterator_(_it: override)
|
||||
return IterableIterator_(_it: override)
|
||||
}
|
||||
}
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension RigidDictionary.Indices.BorrowingIterator_: BorrowingIteratorProtocol_
|
||||
extension RigidDictionary.Indices.IterableIterator_: IterableIteratorProtocol_
|
||||
where Key: ~Copyable, Value: ~Copyable {
|
||||
public typealias Element_ = Element
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import ContainersPreview
|
||||
#if compiler(>=6.4) && UnstableHashedContainers && UnstableContainersPreview
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidSet: BorrowingSequence_ where Element: ~Copyable {
|
||||
extension RigidSet: Iterable_ where Element: ~Copyable {
|
||||
public typealias Element_ = Element
|
||||
|
||||
@inlinable
|
||||
@@ -33,13 +33,13 @@ extension RigidSet: BorrowingSequence_ where Element: ~Copyable {
|
||||
|
||||
@inlinable
|
||||
@_lifetime(borrow self)
|
||||
public borrowing func makeBorrowingIterator_() -> BorrowingIterator_ {
|
||||
BorrowingIterator_(_set: self)
|
||||
public borrowing func makeIterableIterator_() -> IterableIterator_ {
|
||||
IterableIterator_(_set: self)
|
||||
}
|
||||
|
||||
@frozen
|
||||
public struct BorrowingIterator_:
|
||||
BorrowingIteratorProtocol_,
|
||||
public struct IterableIterator_:
|
||||
IterableIteratorProtocol_,
|
||||
~Copyable,
|
||||
~Escapable
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ extension RigidSet {
|
||||
|
||||
guard left.count == right.count else { return false }
|
||||
|
||||
var lit = left.makeBorrowingIterator_()
|
||||
var lit = left.makeIterableIterator_()
|
||||
while true {
|
||||
let l = lit.nextSpan_()
|
||||
if l.isEmpty { break }
|
||||
|
||||
@@ -37,7 +37,7 @@ extension RigidSet {
|
||||
public func _rawHashValue(seed: Int) -> Int {
|
||||
#if UnstableContainersPreview
|
||||
var hash = 0
|
||||
var it = self.makeBorrowingIterator_()
|
||||
var it = self.makeIterableIterator_()
|
||||
while true {
|
||||
let next = it.nextSpan_()
|
||||
var i = 0
|
||||
|
||||
@@ -85,7 +85,7 @@ extension RigidSet /* where Element: Copyable */ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
S: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
capacity: Int,
|
||||
copying contents: borrowing S
|
||||
@@ -119,7 +119,7 @@ extension RigidSet /* where Element: Copyable */ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<
|
||||
S: BorrowingSequence_<Element> & Sequence<Element>
|
||||
S: Iterable_<Element> & Sequence<Element>
|
||||
>(
|
||||
capacity: Int,
|
||||
copying contents: borrowing S
|
||||
@@ -131,7 +131,7 @@ extension RigidSet /* where Element: Copyable */ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<
|
||||
S: BorrowingSequence_<Element> & Collection<Element>
|
||||
S: Iterable_<Element> & Collection<Element>
|
||||
>(
|
||||
capacity: Int? = nil,
|
||||
copying contents: S
|
||||
|
||||
@@ -223,11 +223,11 @@ extension RigidSet /* where Element: Copyable */ {
|
||||
#if UnstableContainersPreview
|
||||
@_alwaysEmitIntoClient
|
||||
package mutating func _insert<
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
S: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
var it = items.makeBorrowingIterator_()
|
||||
var it = items.makeIterableIterator_()
|
||||
while true {
|
||||
let span = it.nextSpan_()
|
||||
guard !span.isEmpty else { break }
|
||||
@@ -240,7 +240,7 @@ extension RigidSet /* where Element: Copyable */ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func insert<
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
S: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
@@ -261,7 +261,7 @@ extension RigidSet /* where Element: Copyable */ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func insert<
|
||||
S: BorrowingSequence_<Element> & Sequence<Element>
|
||||
S: Iterable_<Element> & Sequence<Element>
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
|
||||
@@ -310,12 +310,12 @@ extension UniqueArray {
|
||||
#if compiler(>=6.4) && UnstableContainersPreview
|
||||
@inlinable
|
||||
internal mutating func _append<
|
||||
Source: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
Source: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying newElements: borrowing Source
|
||||
) {
|
||||
_ensureFreeCapacity(newElements.underestimatedCount_)
|
||||
var it = newElements.makeBorrowingIterator_()
|
||||
var it = newElements.makeIterableIterator_()
|
||||
while true {
|
||||
let span = it.nextSpan_()
|
||||
if span.isEmpty { break }
|
||||
@@ -343,7 +343,7 @@ extension UniqueArray {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func append<
|
||||
Source: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
Source: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying newElements: borrowing Source
|
||||
) {
|
||||
@@ -397,7 +397,7 @@ extension UniqueArray {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func append<
|
||||
Source: BorrowingSequence_<Element> & Sequence<Element>
|
||||
Source: Iterable_<Element> & Sequence<Element>
|
||||
>(copying newElements: Source) {
|
||||
self._append(copying: newElements)
|
||||
}
|
||||
|
||||
@@ -20,16 +20,16 @@ import ContainersPreview
|
||||
|
||||
#if compiler(>=6.4) && UnstableContainersPreview
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray: BorrowingSequence_ where Element: ~Copyable {
|
||||
public typealias BorrowingIterator_ = RigidArray<Element>.BorrowingIterator_
|
||||
extension UniqueArray: Iterable_ where Element: ~Copyable {
|
||||
public typealias IterableIterator_ = RigidArray<Element>.IterableIterator_
|
||||
|
||||
@inlinable
|
||||
public var underestimatedCount_: Int { count }
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func makeBorrowingIterator_() -> BorrowingIterator_ {
|
||||
self._storage.makeBorrowingIterator_()
|
||||
public func makeIterableIterator_() -> IterableIterator_ {
|
||||
self._storage.makeIterableIterator_()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -96,7 +96,7 @@ extension UniqueArray /*where Element: Copyable*/ {
|
||||
/// The sequence must not contain more than `capacity` elements.
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<Source: BorrowingSequence_<Element> & ~Copyable & ~Escapable>(
|
||||
public init<Source: Iterable_<Element> & ~Copyable & ~Escapable>(
|
||||
capacity: Int? = nil,
|
||||
copying contents: borrowing Source
|
||||
) {
|
||||
@@ -132,7 +132,7 @@ extension UniqueArray /*where Element: Copyable*/ {
|
||||
/// - contents: The container whose contents to copy into the new array.
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<Source: BorrowingSequence_<Element> & Sequence<Element>>(
|
||||
public init<Source: Iterable_<Element> & Sequence<Element>>(
|
||||
capacity: Int? = nil,
|
||||
copying contents: Source
|
||||
) {
|
||||
|
||||
@@ -19,9 +19,9 @@ import ContainersPreview
|
||||
#if compiler(>=6.4) && UnstableHashedContainers && UnstableContainersPreview
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet: BorrowingSequence_ where Element: ~Copyable {
|
||||
extension UniqueSet: Iterable_ where Element: ~Copyable {
|
||||
public typealias Element_ = Element
|
||||
public typealias BorrowingIterator_ = RigidSet<Element>.BorrowingIterator_
|
||||
public typealias IterableIterator_ = RigidSet<Element>.IterableIterator_
|
||||
|
||||
@inlinable
|
||||
public var underestimatedCount_: Int { count }
|
||||
@@ -35,8 +35,8 @@ extension UniqueSet: BorrowingSequence_ where Element: ~Copyable {
|
||||
|
||||
@inlinable
|
||||
@_lifetime(borrow self)
|
||||
public borrowing func makeBorrowingIterator_() -> BorrowingIterator_ {
|
||||
BorrowingIterator_(_set: _storage)
|
||||
public borrowing func makeIterableIterator_() -> IterableIterator_ {
|
||||
IterableIterator_(_set: _storage)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -77,7 +77,7 @@ extension UniqueSet where Element: Copyable {
|
||||
#if UnstableContainersPreview
|
||||
@_alwaysEmitIntoClient
|
||||
public init<
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
S: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
@@ -95,7 +95,7 @@ extension UniqueSet where Element: Copyable {
|
||||
#if UnstableContainersPreview
|
||||
@_alwaysEmitIntoClient
|
||||
public init<
|
||||
S: BorrowingSequence_<Element> & Sequence<Element>
|
||||
S: Iterable_<Element> & Sequence<Element>
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
|
||||
@@ -132,12 +132,12 @@ extension UniqueSet /* where Element: Copyable */ {
|
||||
#if UnstableContainersPreview
|
||||
@_alwaysEmitIntoClient
|
||||
package mutating func _insert<
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
S: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
_ensureFreeCapacity(items.underestimatedCount_)
|
||||
var it = items.makeBorrowingIterator_()
|
||||
var it = items.makeIterableIterator_()
|
||||
while true {
|
||||
let span = it.nextSpan_()
|
||||
guard !span.isEmpty else { break }
|
||||
@@ -150,7 +150,7 @@ extension UniqueSet /* where Element: Copyable */ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func insert<
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
S: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
@@ -172,7 +172,7 @@ extension UniqueSet /* where Element: Copyable */ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func insert<
|
||||
S: BorrowingSequence_<Element> & Sequence<Element>
|
||||
S: Iterable_<Element> & Sequence<Element>
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
|
||||
Reference in new issue
Block a user