diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index b4883d0..98ab39b 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -13,8 +13,10 @@ needs to be listed here. - Franz Busch - Guoye Zhang +- Gwynne Raskind - Jager-yoo - Sergey Dmitriev +- Tim Condon <0xTim@users.noreply.github.com> - Tomohiro Kumagai **Updating this list** diff --git a/Sources/HTTPTypes/HTTPFields.swift b/Sources/HTTPTypes/HTTPFields.swift index e371232..e2f8d2d 100644 --- a/Sources/HTTPTypes/HTTPFields.swift +++ b/Sources/HTTPTypes/HTTPFields.swift @@ -216,30 +216,30 @@ public struct HTTPFields: Sendable, Hashable { } } - private func fields(for name: HTTPField.Name) -> some Sequence { - struct HTTPFieldSequence: Sequence { - let fields: [(field: HTTPField, next: UInt16)] - let index: UInt16 + private struct HTTPFieldSequence: Sequence { + let fields: [(field: HTTPField, next: UInt16)] + let index: UInt16 - struct Iterator: IteratorProtocol { - let fields: [(field: HTTPField, next: 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 } + let (field, next) = self.fields[Int(self.index)] + self.index = next + return field } + } - func makeIterator() -> Iterator { - Iterator(fields: self.fields, index: self.index) - } + 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) }