AsyncIterator
HTTPClientRequest.swift:394- iOS
- 13.0+
- macOS
- 10.15+
- tvOS
- 13.0+
- watchOS
- 6.0+
struct AsyncIterator
struct AsyncIterator
import AsyncHTTPClient
This package provides simple HTTP Client library built on top of SwiftNIO.
struct Body
An HTTP request body.
struct HTTPClientRequest
A representation of an HTTP request for the Swift Concurrency HTTPClient API.
static func bytes(_ byteBuffer: ByteBuffer) -> HTTPClientRequest.Body
Create an Body
from a ByteBuffer
.
@preconcurrency static func bytes<Bytes>(_ bytes: Bytes) -> HTTPClientRequest.Body where Bytes : RandomAccessCollection, Bytes : Sendable, Bytes.Element == UInt8
Create an Body
from a RandomAccessCollection
of bytes.
@preconcurrency static func bytes<Bytes>(_ bytes: Bytes, length: Length) -> HTTPClientRequest.Body where Bytes : Sendable, Bytes : Sequence, Bytes.Element == UInt8
Create an Body
from a Sequence
of bytes.
@preconcurrency static func bytes<Bytes>(_ bytes: Bytes, length: Length) -> HTTPClientRequest.Body where Bytes : Collection, Bytes : Sendable, Bytes.Element == UInt8
Create an Body
from a Collection
of bytes.
@preconcurrency static func stream<SequenceOfBytes>(_ sequenceOfBytes: SequenceOfBytes, length: Length) -> HTTPClientRequest.Body where SequenceOfBytes : Sendable, SequenceOfBytes : AsyncSequence, SequenceOfBytes.Element == ByteBuffer
Create an Body
from an AsyncSequence
of ByteBuffer
s.
@preconcurrency static func stream<Bytes>(_ bytes: Bytes, length: Length) -> HTTPClientRequest.Body where Bytes : Sendable, Bytes : AsyncSequence, Bytes.Element == UInt8
Create an Body
from an AsyncSequence
of bytes.
func makeAsyncIterator() -> AsyncIterator
struct Length
The length of a HTTP request body.
typealias Element = ByteBuffer
protocol AsyncIteratorProtocol<Element, Failure>
A type that asynchronously supplies the values of a sequence one at a time.
mutating func next() async throws -> ByteBuffer?
mutating func next(isolation actor: isolated (any Actor)?) async throws(Self.Failure) -> Self.Element?
Default implementation of next()
in terms of next()
, which is required to maintain backward compatibility with existing async iterators.