mirror of
https://github.com/apple/swift-collections
synced 2026-11-29 05:14:20 +00:00
Align BorrowingSequence etc with proposal
This updates the ContainersPreview module to use the same API as the proposed BorrowingSequence protocol and its supporting types. In particular, instead of using Span as the iterator for itself and other contiguously-stored types, this introduces SpanIterator.
This commit is contained in:
1 parent
b3d681b4e3
commit
a2cf230400
4 files changed
+112
-64
No files matched your search
@@ -21,7 +21,7 @@ import ContainersPreview
|
||||
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray: BorrowingSequence where Element: ~Copyable {
|
||||
public typealias BorrowingIterator = Span<Element>.BorrowingIterator
|
||||
public typealias BorrowingIterator = SpanIterator<Element>
|
||||
|
||||
@inlinable
|
||||
public var underestimatedCount: Int { count }
|
||||
@@ -29,7 +29,7 @@ extension RigidArray: BorrowingSequence where Element: ~Copyable {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func makeBorrowingIterator() -> BorrowingIterator {
|
||||
self.span.makeBorrowingIterator()
|
||||
SpanIterator(self.span)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user