Files
Tolga Unal 68fd4f2cc8 [DequeModule] Make UniqueDeque Iterable without ContainersPreview
842f125c removed the trait conditions around the Iterable APIs, but
UniqueDeque only got its conformance through Container in ContainersPreview.
RigidDeque had no underestimatedCount, so it was 0 through Iterable.
2026-11-05 09:09:48 -05:00

31 lines
936 B
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2026 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
// SPDX-License-Identifier: Apache-2.0 WITH Swift-exception
//
//===----------------------------------------------------------------------===//
#if compiler(>=6.4)
@available(SwiftStdlib 5.0, *)
extension UniqueDeque: Iterable where Element: ~Copyable {
public typealias BorrowingIterator = RigidDeque<Element>.BorrowingIterator
@inlinable
public var underestimatedCount: Int { count }
@_alwaysEmitIntoClient
@_lifetime(borrow self)
public borrowing func makeBorrowingIterator() -> BorrowingIterator {
BorrowingIterator(_deque: self._storage)
}
}
#endif