Skip to content

Commit ff2e387

Browse files
committed
Add InlineArray Iterable conformance
1 parent a9ee0b6 commit ff2e387

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

stdlib/public/core/InlineArray.swift

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
/// let b: InlineArray<_, Int> = [1, 2, 3]
3131
/// let c: InlineArray<3, _> = [1, 2, 3]
3232
/// let d: InlineArray = [1, 2, 3]
33-
///
33+
///
3434
/// let e: [3 of Int] = [1, 2, 3]
3535
/// let f: [_ of Int] = [1, 2, 3]
3636
/// let g: [3 of _] = [1, 2, 3]
@@ -606,3 +606,21 @@ extension InlineArray where Element: ~Copyable {
606606
}
607607
}
608608
}
609+
610+
@available(SwiftStdlib 6.3, *)
611+
extension InlineArray: Iterable where Element: ~Copyable {
612+
public typealias BorrowIterator = Span<Element>.BorrowIterator
613+
614+
@_alwaysEmitIntoClient
615+
@_transparent
616+
public var estimatedCount: EstimatedCount {
617+
.exactly(count)
618+
}
619+
620+
@_alwaysEmitIntoClient
621+
@_lifetime(borrow self)
622+
@_transparent
623+
public func startBorrowIteration() -> Span<Element> {
624+
span
625+
}
626+
}

0 commit comments

Comments
 (0)