Merge pull request #38 from gwynne/patch-1

Stop using opaque return types to resolve build error
This commit is contained in:
Guoye Zhang authored and GitHub committed 2023-12-02 13:08:22 -08:00
commit 1827dc94bd
2 files changed
+20 -18

No files matched your search

+2
View File
@@ -13,8 +13,10 @@ needs to be listed here.
- Franz Busch <f.busch@apple.com>
- Guoye Zhang <guoye_zhang@apple.com>
- Gwynne Raskind <gwynne@vapor.codes>
- Jager-yoo <y73447jh@gmail.com>
- Sergey Dmitriev <s.dmitriev@safe-tech.ru>
- Tim Condon <0xTim@users.noreply.github.com>
- Tomohiro Kumagai <tomo@ez-net.jp>
**Updating this list**
+18 -18
View File
@@ -216,30 +216,30 @@ public struct HTTPFields: Sendable, Hashable {
}
}
private func fields(for name: HTTPField.Name) -> some Sequence<HTTPField> {
struct HTTPFieldSequence: Sequence {
private struct HTTPFieldSequence: Sequence {
let fields: [(field: HTTPField, next: UInt16)]
let index: UInt16
struct Iterator: IteratorProtocol {
let fields: [(field: HTTPField, next: UInt16)]
let index: UInt16
var index: UInt16
struct Iterator: IteratorProtocol {
let fields: [(field: HTTPField, next: UInt16)]
var index: UInt16
mutating func next() -> HTTPField? {
if self.index == .max {
return nil
}
let (field, next) = self.fields[Int(self.index)]
self.index = next
return field
mutating func next() -> HTTPField? {
if self.index == .max {
return nil
}
}
func makeIterator() -> Iterator {
Iterator(fields: self.fields, index: self.index)
let (field, next) = self.fields[Int(self.index)]
self.index = next
return field
}
}
func makeIterator() -> Iterator {
Iterator(fields: self.fields, index: self.index)
}
}
private func fields(for name: HTTPField.Name) -> HTTPFieldSequence {
let index = self._storage.ensureIndex[name.canonicalName]?.first ?? .max
return HTTPFieldSequence(fields: self._storage.fields, index: index)
}