mirror of
https://github.com/apple/swift-collections
synced 2026-11-28 05:04:21 +00:00
Merge pull request #598 from lorentey/remove-BorrowingSequence.first
[ContainersPreview] Remove BorrowingSequence.first
This commit is contained in:
1 file changed
-13
@@ -47,19 +47,6 @@ extension BorrowingSequence where Self: Sequence {
|
||||
}
|
||||
}
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension BorrowingSequence where Element: Copyable {
|
||||
// FIXME: How do we expect this to work for ~Copyable elements?
|
||||
public var first: Element? {
|
||||
var it = makeBorrowingIterator()
|
||||
let span = it.nextSpan(maximumCount: 1)
|
||||
guard !span.isEmpty else { return nil }
|
||||
return span[0]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension BorrowingSequence where Self: ~Copyable & ~Escapable {
|
||||
/// Implementation demo of what borrowing for-in loops would need to expand into.
|
||||
|
||||
Reference in new issue
Block a user