Skip to content

Commit

Permalink
Make AsyncSequenceResponseBodyStreamer public
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Sep 11, 2023
1 parent 7d86d26 commit 4ad3198
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import HummingbirdCore

/// Response body streamer which uses an AsyncSequence as its input.
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
final class AsyncSequenceResponseBodyStreamer<ByteBufferSequence: AsyncSequence>: HBResponseBodyStreamer where ByteBufferSequence.Element == ByteBuffer {
public final class AsyncSequenceResponseBodyStreamer<ByteBufferSequence: AsyncSequence>: HBResponseBodyStreamer where ByteBufferSequence.Element == ByteBuffer {
var iterator: ByteBufferSequence.AsyncIterator

init(_ asyncSequence: ByteBufferSequence) {
public init(_ asyncSequence: ByteBufferSequence) {
self.iterator = asyncSequence.makeAsyncIterator()
}

func read(on eventLoop: EventLoop) -> EventLoopFuture<HBStreamerOutput> {
public func read(on eventLoop: EventLoop) -> EventLoopFuture<HBStreamerOutput> {
let promise = eventLoop.makePromise(of: HBStreamerOutput.self)
promise.completeWithTask {
if let buffer = try await self.iterator.next() {
Expand Down

0 comments on commit 4ad3198

Please sign in to comment.