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
@@ -313,9 +313,9 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
#if compiler(>=6.4) && UnstableContainersPreview
|
||||
@_alwaysEmitIntoClient
|
||||
internal mutating func _append<
|
||||
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_()
|
||||
if span.isEmpty { break }
|
||||
@@ -334,7 +334,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
///
|
||||
/// - Complexity: O(*m*), where *m* is the length of `newElements`.
|
||||
@_alwaysEmitIntoClient
|
||||
public mutating func append<S: BorrowingSequence_<Element> & ~Copyable & ~Escapable>(
|
||||
public mutating func append<S: Iterable_<Element> & ~Copyable & ~Escapable>(
|
||||
copying newElements: borrowing S
|
||||
) {
|
||||
self._append(copying: newElements)
|
||||
@@ -375,7 +375,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
/// - Complexity: O(*m*), where *m* is the length of `items`. @available(SwiftStdlib 5.0, *)
|
||||
@_alwaysEmitIntoClient
|
||||
public mutating func append<
|
||||
S: BorrowingSequence_<Element> & Sequence<Element>
|
||||
S: Iterable_<Element> & Sequence<Element>
|
||||
>(
|
||||
copying items: S
|
||||
) {
|
||||
|
||||
@@ -23,7 +23,7 @@ import ContainersPreview
|
||||
extension RigidDeque where Element: ~Copyable {
|
||||
#if compiler(>=6.4) && UnstableContainersPreview
|
||||
@frozen
|
||||
public struct BorrowingIterator: ~Escapable, BorrowingIteratorProtocol_ {
|
||||
public struct BorrowingIterator: ~Escapable, IterableIteratorProtocol_ {
|
||||
public typealias Element_ = Element
|
||||
|
||||
@usableFromInline
|
||||
@@ -60,7 +60,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_lifetime(borrow self)
|
||||
public borrowing func makeBorrowingIterator_() -> BorrowingIterator {
|
||||
public borrowing func makeIterableIterator_() -> BorrowingIterator {
|
||||
BorrowingIterator(_deque: self)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -132,7 +132,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
S: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
capacity: Int,
|
||||
copying contents: borrowing S
|
||||
@@ -187,7 +187,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<
|
||||
S: BorrowingSequence_<Element> & Sequence<Element>
|
||||
S: Iterable_<Element> & Sequence<Element>
|
||||
>(
|
||||
capacity: Int,
|
||||
copying contents: borrowing S
|
||||
@@ -208,7 +208,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<
|
||||
S: BorrowingSequence_<Element> & Collection<Element>
|
||||
S: Iterable_<Element> & Collection<Element>
|
||||
>(
|
||||
capacity: Int? = nil,
|
||||
copying contents: S
|
||||
|
||||
@@ -365,7 +365,7 @@ extension RigidDeque /* where Element: Copyable */ {
|
||||
newCount: Int
|
||||
) {
|
||||
let expectedCount = self.count + newCount
|
||||
var it = items.makeBorrowingIterator_()
|
||||
var it = items.makeIterableIterator_()
|
||||
insert(addingCount: newCount, at: index) { target in
|
||||
it._copyContents_(into: &target)
|
||||
}
|
||||
|
||||
@@ -290,13 +290,13 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
#if compiler(>=6.4) && UnstableContainersPreview
|
||||
@inlinable
|
||||
internal mutating func _prepend<
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
S: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(copying items: borrowing S) {
|
||||
// We don't know the exact count of new elements, so we cannot initialize
|
||||
// them in place. Append them to the end of the deque first, then rotate
|
||||
// them to their correct location.
|
||||
//
|
||||
// FIXME: If we get a BorrowingSequence_.estimatedCount with an exact case,
|
||||
// FIXME: If we get a Iterable_.estimatedCount with an exact case,
|
||||
// then we should use that when possible to copy items to their final
|
||||
// location in a single pass.
|
||||
let oldCount = self.count
|
||||
@@ -306,12 +306,12 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
|
||||
@inlinable
|
||||
internal mutating func _prepend<
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
S: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying items: borrowing S,
|
||||
exactCount: Int
|
||||
) {
|
||||
var it = items.makeBorrowingIterator_()
|
||||
var it = items.makeIterableIterator_()
|
||||
self.prepend(addingCount: exactCount) { target in
|
||||
let span = it.nextSpan_(maximumCount: target.freeCapacity)
|
||||
target._append(copying: span)
|
||||
@@ -333,7 +333,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
///
|
||||
/// - Complexity: O(*m*), where *m* is the length of `items`.
|
||||
@_alwaysEmitIntoClient
|
||||
public mutating func prepend<S: BorrowingSequence_<Element> & ~Copyable & ~Escapable>(
|
||||
public mutating func prepend<S: Iterable_<Element> & ~Copyable & ~Escapable>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
self._prepend(copying: items)
|
||||
@@ -437,7 +437,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
///
|
||||
/// - Complexity: O(*m*), where *m* is the length of `items`.
|
||||
@_alwaysEmitIntoClient
|
||||
public mutating func prepend<S: BorrowingSequence_<Element> & Sequence<Element>>(
|
||||
public mutating func prepend<S: Iterable_<Element> & Sequence<Element>>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
self._prepend(copying: items)
|
||||
@@ -453,7 +453,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
///
|
||||
/// - Complexity: O(*m*), where *m* is the length of `items`.
|
||||
@_alwaysEmitIntoClient
|
||||
public mutating func prepend<S: BorrowingSequence_<Element> & Collection<Element>>(
|
||||
public mutating func prepend<S: Iterable_<Element> & Collection<Element>>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
self._prepend(copying: items, exactCount: items.count)
|
||||
|
||||
@@ -466,7 +466,7 @@ extension RigidDeque /* where Element: Copyable */ {
|
||||
) {
|
||||
|
||||
let expectedCount = self.count - subrange.count + newCount
|
||||
var it = items.makeBorrowingIterator_()
|
||||
var it = items.makeIterableIterator_()
|
||||
self.replace(removing: subrange, addingCount: newCount) { target in
|
||||
it._copyContents_(into: &target)
|
||||
}
|
||||
|
||||
@@ -300,9 +300,9 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
#if compiler(>=6.4) && UnstableContainersPreview
|
||||
@_alwaysEmitIntoClient
|
||||
internal mutating func _append<
|
||||
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_()
|
||||
if span.isEmpty { break }
|
||||
@@ -323,7 +323,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
/// - Complexity: O(*m*), where *m* is the length of `items`, when amortized
|
||||
/// over many similar invocations on the same deque
|
||||
@_alwaysEmitIntoClient
|
||||
public mutating func append<S: BorrowingSequence_<Element> & ~Copyable & ~Escapable>(
|
||||
public mutating func append<S: Iterable_<Element> & ~Copyable & ~Escapable>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
self._append(copying: items)
|
||||
@@ -374,7 +374,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
/// amortized over many similar invocations over the same deque.
|
||||
@_alwaysEmitIntoClient
|
||||
public mutating func append<
|
||||
S: BorrowingSequence_<Element> & Sequence<Element>
|
||||
S: Iterable_<Element> & Sequence<Element>
|
||||
>(
|
||||
copying items: S
|
||||
) {
|
||||
|
||||
@@ -26,7 +26,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_lifetime(borrow self)
|
||||
public borrowing func makeBorrowingIterator_() -> BorrowingIterator {
|
||||
public borrowing func makeIterableIterator_() -> BorrowingIterator {
|
||||
BorrowingIterator(_deque: self._storage)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -145,7 +145,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
S: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
capacity: Int? = nil,
|
||||
copying contents: borrowing S
|
||||
@@ -184,7 +184,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<
|
||||
S: BorrowingSequence_<Element> & Sequence<Element>
|
||||
S: Iterable_<Element> & Sequence<Element>
|
||||
>(
|
||||
capacity: Int? = nil,
|
||||
copying contents: S
|
||||
@@ -203,7 +203,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<
|
||||
S: BorrowingSequence_<Element> & Collection<Element>
|
||||
S: Iterable_<Element> & Collection<Element>
|
||||
>(
|
||||
capacity: Int? = nil,
|
||||
copying contents: S
|
||||
|
||||
@@ -383,7 +383,7 @@ extension UniqueDeque /* where Element: Copyable */ {
|
||||
newCount: Int
|
||||
) {
|
||||
let expectedCount = self.count + newCount
|
||||
var it = items.makeBorrowingIterator_()
|
||||
var it = items.makeIterableIterator_()
|
||||
insert(addingCount: newCount, at: index) { target in
|
||||
it._copyContents_(into: &target)
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
#if compiler(>=6.4) && UnstableContainersPreview
|
||||
@inlinable
|
||||
internal mutating func _prepend<
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
S: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(copying items: borrowing S) {
|
||||
// We don't know the exact count of new elements, so we cannot initialize
|
||||
// them in place. Append them to the end of the deque first, then rotate
|
||||
@@ -338,12 +338,12 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
|
||||
@inlinable
|
||||
internal mutating func _prepend<
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
S: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying items: borrowing S,
|
||||
exactCount: Int
|
||||
) {
|
||||
var it = items.makeBorrowingIterator_()
|
||||
var it = items.makeIterableIterator_()
|
||||
self.prepend(addingCount: exactCount) { target in
|
||||
let span = it.nextSpan_(maximumCount: target.freeCapacity)
|
||||
target._append(copying: span)
|
||||
@@ -367,7 +367,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
/// over many similar invocations on the same deque.
|
||||
@_alwaysEmitIntoClient
|
||||
public mutating func prepend<
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
S: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
@@ -479,7 +479,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
/// over many similar invocations on the same deque.
|
||||
@_alwaysEmitIntoClient
|
||||
public mutating func prepend<
|
||||
S: BorrowingSequence_<Element> & Sequence<Element>
|
||||
S: Iterable_<Element> & Sequence<Element>
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
@@ -498,7 +498,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
/// over many similar invocations on the same deque.
|
||||
@_alwaysEmitIntoClient
|
||||
public mutating func prepend<
|
||||
S: BorrowingSequence_<Element> & Collection<Element>
|
||||
S: Iterable_<Element> & Collection<Element>
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
|
||||
@@ -475,7 +475,7 @@ extension UniqueDeque /* where Element: Copyable */ {
|
||||
) {
|
||||
|
||||
let expectedCount = self.count - subrange.count + newCount
|
||||
var it = items.makeBorrowingIterator_()
|
||||
var it = items.makeIterableIterator_()
|
||||
self.replace(removing: subrange, addingCount: newCount) { target in
|
||||
it._copyContents_(into: &target)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user