mirror of
https://github.com/apple/swift-http-types
synced 2026-11-25 04:47:48 +00:00
Merge pull request #38 from gwynne/patch-1
Stop using opaque return types to resolve build error
This commit is contained in:
2 files changed
+20
-18
No files matched your search
@@ -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**
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user