yield(_:)

Yields a new elements to the NIOAsyncSequenceProducer.

NIOAsyncSequenceProducer.swift:323
iOS
13+
macOS
10.15+
tvOS
13+
watchOS
6+
func yield(_ element: Element) -> NIOAsyncSequenceProducer<Element, Strategy, Delegate>.Source.YieldResult

Parameters

element

The element to yield.

Returns

A YieldResult that indicates if the yield was successful and if more elements should be produced.

If there is an AsyncIterator awaiting the next element, it will get resumed right away. Otherwise, the element will get buffered.

If the NIOAsyncSequenceProducer is terminated this will drop the elements and return dropped.

This can be called more than once and returns to the caller immediately without blocking for any awaiting consumption from the iteration.