Structurehummingbird 2.10.0HummingbirdCore
ResponseBody
Response body
struct ResponseBody
Response body
struct ResponseBody
import HummingbirdCore
protocol Sendable
init()
Initialise empty ResponseBody
init<BufferSequence>(asyncSequence: BufferSequence) where BufferSequence : Sendable, BufferSequence : AsyncSequence, BufferSequence.Element == ByteBuffer
Initialise ResponseBody with an AsyncSequence of ByteBuffers
init(byteBuffer: ByteBuffer)
Initialise ResponseBody that contains a single ByteBuffer
init(contentLength: Int? = nil, _ write: @escaping (inout any ResponseBodyWriter) async throws -> Void)
Initialise ResponseBody with closure writing body contents.
init<BufferSequence>(contentsOf byteBuffers: BufferSequence) where BufferSequence : Sendable, BufferSequence : Sequence, BufferSequence.Element == ByteBuffer
Initialise ResponseBody that contains a sequence of ByteBuffers
let contentLength: Int?
consuming func map(_ transform: @escaping (ByteBuffer) async throws -> ByteBuffer) -> ResponseBody
Returns a ResponseBody containing the results of mapping the given closure over the sequence of ByteBuffers written.
func withPostWriteClosure(_ postWrite: @escaping () async -> Void) -> ResponseBody
Create new response body that calls a closure once original response body has been written to the channel
consuming func write(_ writer: consuming any ResponseBodyWriter) async throws