diff --git a/FlyingFox/Sources/HTTPDecoder.swift b/FlyingFox/Sources/HTTPDecoder.swift index e0c24cd..384fac9 100644 --- a/FlyingFox/Sources/HTTPDecoder.swift +++ b/FlyingFox/Sources/HTTPDecoder.swift @@ -34,7 +34,7 @@ import Foundation struct HTTPDecoder { - static func decodeRequest(from bytes: S) async throws -> HTTPRequest where S: AsyncChunkedSequence, S.Element == UInt8 { + static func decodeRequest(from bytes: some AsyncChunkedSequence) async throws -> HTTPRequest { let status = try await bytes.lines.takeNext() let comps = status .trimmingCharacters(in: .whitespacesAndNewlines) @@ -60,7 +60,7 @@ struct HTTPDecoder { ) } - static func decodeResponse(from bytes: S) async throws -> HTTPResponse where S: AsyncChunkedSequence, S.Element == UInt8 { + static func decodeResponse(from bytes: some AsyncChunkedSequence) async throws -> HTTPResponse { let comps = try await bytes.lines.takeNext() .trimmingCharacters(in: .whitespacesAndNewlines) .split(separator: " ", maxSplits: 2, omittingEmptySubsequences: true) diff --git a/FlyingFox/Sources/WebSocket/WSFrameEncoder.swift b/FlyingFox/Sources/WebSocket/WSFrameEncoder.swift index 803280a..1c47b62 100644 --- a/FlyingFox/Sources/WebSocket/WSFrameEncoder.swift +++ b/FlyingFox/Sources/WebSocket/WSFrameEncoder.swift @@ -117,7 +117,7 @@ struct WSFrameEncoder { } } - static func decodePayload(from bytes: S, length: Int, mask: WSFrame.Mask?) async throws -> Data where S: AsyncChunkedSequence, S.Element == UInt8 { + static func decodePayload(from bytes: some AsyncChunkedSequence, length: Int, mask: WSFrame.Mask?) async throws -> Data { var iterator = bytes.makeAsyncIterator() guard var payload = try await iterator.nextChunk(count: length) else { throw SocketError.disconnected @@ -130,7 +130,7 @@ struct WSFrameEncoder { return Data(payload) } - static func decodeLengthMask(from bytes: S) async throws -> (length: Int, mask: WSFrame.Mask?) where S: AsyncChunkedSequence, S.Element == UInt8 { + static func decodeLengthMask(from bytes: some AsyncChunkedSequence) async throws -> (length: Int, mask: WSFrame.Mask?) { let byte0 = try await bytes.take() let hasMask = byte0 & 0b10000000 == 0b10000000 let length0 = byte0 & 0b01111111 @@ -158,7 +158,7 @@ struct WSFrameEncoder { } } - static func decodeMask(from bytes: S) async throws -> WSFrame.Mask where S: AsyncChunkedSequence, S.Element == UInt8 { + static func decodeMask(from bytes: some AsyncChunkedSequence) async throws -> WSFrame.Mask { try await WSFrame.Mask(m1: bytes.take(), m2: bytes.take(), m3: bytes.take(),