AnyThrowingAsyncSequenceable
public struct AnyThrowingAsyncSequenceable<Element> : AsyncSequence
extension AnyThrowingAsyncSequenceable: AsyncIteratorProtocol
A throwing async sequence that performs type erasure by wrapping another throwing async sequence.
If the async sequence that you wish to type erase doesn’t throw, then use AnyAsyncSequenceable
.
-
Creates a type erasing async sequence.
Declaration
Swift
public init<T>(_ asyncSequence: T) where Element == T.Element, T : AsyncSequence
Parameters
sequence
The async sequence to type erase.
-
Creates an optional type erasing async sequence.
Declaration
Swift
public init?<T>(_ asyncSequence: T?) where Element == T.Element, T : AsyncSequence
Parameters
sequence
An optional async sequence to type erase.
-
Creates an async iterator that emits elements of this async sequence.
Declaration
Swift
public func makeAsyncIterator() -> AnyThrowingAsyncSequenceable<Element>
Return Value
An instance that conforms to
AsyncIteratorProtocol
.
-
next()
AsynchronousProduces the next element in the sequence.
Declaration
Swift
public mutating func next() async throws -> Element?
Return Value
The next element or
nil
if the end of the sequence is reached.