@@ -63,7 +63,7 @@ public struct HTTPField: Sendable, Hashable {
63
63
/// - Parameters:
64
64
/// - name: The HTTP field name.
65
65
/// - value: The HTTP field value. Invalid bytes are converted into space characters.
66
- public init < C : Collection > ( name: Name , value: C ) where C . Element == UInt8 {
66
+ public init ( name: Name , value: some Collection < UInt8 > ) {
67
67
self . name = name
68
68
self . rawValue = Self . legalizeValue ( ISOLatin1String ( value) )
69
69
}
@@ -111,7 +111,7 @@ public struct HTTPField: Sendable, Hashable {
111
111
112
112
var rawValue : ISOLatin1String
113
113
114
- private static func _isValidValue< S : Sequence > ( _ bytes: S ) -> Bool where S . Element == UInt8 {
114
+ private static func _isValidValue( _ bytes: some Sequence < UInt8 > ) -> Bool {
115
115
var iterator = bytes. makeIterator ( )
116
116
guard var byte = iterator. next ( ) else {
117
117
// Empty string is allowed.
@@ -178,7 +178,7 @@ public struct HTTPField: Sendable, Hashable {
178
178
///
179
179
/// - Parameter value: The byte collection to validate.
180
180
/// - Returns: Whether the byte collection is valid.
181
- public static func isValidValue< C : Collection > ( _ value: C ) -> Bool where C . Element == UInt8 {
181
+ public static func isValidValue( _ value: some Collection < UInt8 > ) -> Bool {
182
182
self . _isValidValue ( value)
183
183
}
184
184
}
@@ -227,7 +227,7 @@ extension HTTPField: Codable {
227
227
}
228
228
229
229
extension HTTPField {
230
- static func isValidToken< S : StringProtocol > ( _ token: S ) -> Bool {
230
+ static func isValidToken( _ token: some StringProtocol ) -> Bool {
231
231
!token. isEmpty && token. utf8. allSatisfy {
232
232
switch $0 {
233
233
case 0x21 , 0x23 , 0x24 , 0x25 , 0x26 , 0x27 , 0x2A , 0x2B , 0x2D , 0x2E , 0x5E , 0x5F , 0x60 , 0x7C , 0x7E :
0 commit comments