mirror of
https://github.com/swift-server/async-http-client.git
synced 2026-05-03 07:32:29 +00:00
eab2a84b1c
* Use explicit NIO imports for `NIOCore`, `NIOPosix` and `NIOEmbedded` * Updated dependencies
33 lines
951 B
Swift
33 lines
951 B
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the AsyncHTTPClient open source project
|
|
//
|
|
// Copyright (c) 2021 Apple Inc. and the AsyncHTTPClient project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of AsyncHTTPClient project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
import NIOCore
|
|
import NIOHTTP1
|
|
|
|
struct ResponseReadBuffer {
|
|
private var responseParts: CircularBuffer<HTTPClientResponsePart>
|
|
|
|
init() {
|
|
self.responseParts = CircularBuffer(initialCapacity: 16)
|
|
}
|
|
|
|
mutating func appendPart(_ part: HTTPClientResponsePart) {
|
|
self.responseParts.append(part)
|
|
}
|
|
|
|
mutating func nextRead() -> HTTPClientResponsePart? {
|
|
return self.responseParts.popFirst()
|
|
}
|
|
}
|