Instance Methodswift-nio 2.72.0NIOCore
yield(_:)
Yields an element to the NIOAsyncWriter
.
- iOS
- 13+
- macOS
- 10.15+
- tvOS
- 13+
- watchOS
- 6+
func yield(_ element: Element) async throws
Parameters
- element
The element to yield.
If the NIOAsyncWriter
is writable the element will get forwarded to the NIOAsyncWriterSinkDelegate
immediately. Otherwise, the element will be buffered and the call to yield(_:)
will get suspended until the NIOAsyncWriter
becomes writable again.
If the calling Task
gets cancelled at any point the call to yield(_:)
will be resumed. Consequently, the provided element will not be yielded.
This can be called more than once and from multiple Task
s at the same time.
Other members in extension
Types
struct NewWriter
Simple struct for the return type of
makeWriter(elementType:isWritable:delegate:)
.
Type members
static func makeWriter(elementType: Element.Type, isWritable: Bool, finishOnDeinit: Bool, delegate: Delegate
) -> NewWriter Initializes a new
NIOAsyncWriter
and aSink
.
Show obsolete interfaces (1)
Hide obsolete interfaces
static func makeWriter(elementType: Element.Type, isWritable: Bool, delegate: Delegate
) -> NewWriter Initializes a new
NIOAsyncWriter
and aSink
.
Instance members
func finish(
) Finishes the writer.
func finish(error: Error
) Finishes the writer.
func yield<S>(contentsOf: S
) async throws Yields a sequence of new elements to the
NIOAsyncWriter
.