mirror of
https://github.com/apple/swift-collections
synced 2026-11-26 04:47:48 +00:00
Align Iterable with proposal
Adds throwing and ~Escapable elements
This commit is contained in:
1 parent
4bda43f4a9
commit
dca015d7e8
37 files changed
+234
-221
No files matched your search
@@ -310,14 +310,14 @@ extension UniqueArray {
|
||||
#if compiler(>=6.4) && UnstableContainersPreview
|
||||
@inlinable
|
||||
internal mutating func _append<
|
||||
Source: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
Source: Iterable_<Element, E> & ~Copyable & ~Escapable, E
|
||||
>(
|
||||
copying newElements: borrowing Source
|
||||
) {
|
||||
) throws(E) {
|
||||
_ensureFreeCapacity(newElements.underestimatedCount_)
|
||||
var it = newElements.makeIterableIterator_()
|
||||
while true {
|
||||
let span = it.nextSpan_()
|
||||
let span = try it.nextSpan_()
|
||||
if span.isEmpty { break }
|
||||
_ensureFreeCapacity(span.count)
|
||||
_storage.append(copying: span)
|
||||
@@ -343,11 +343,11 @@ extension UniqueArray {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func append<
|
||||
Source: Iterable_<Element> & ~Copyable & ~Escapable
|
||||
Source: Iterable_<Element, E> & ~Copyable & ~Escapable, E
|
||||
>(
|
||||
copying newElements: borrowing Source
|
||||
) {
|
||||
self._append(copying: newElements)
|
||||
) throws(E) {
|
||||
try self._append(copying: newElements)
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -397,7 +397,7 @@ extension UniqueArray {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func append<
|
||||
Source: Iterable_<Element> & Sequence<Element>
|
||||
Source: Iterable_<Element, Never> & Sequence<Element>
|
||||
>(copying newElements: Source) {
|
||||
self._append(copying: newElements)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user