Contents

yield(_:)

Resume the task awaiting the next iteration point by having it return normally from its suspension point with a given element.

Declaration

@discardableResult func yield(_ value: sending Element) -> AsyncStream<Element>.Continuation.YieldResult

Parameters

  • value:

    The value to yield from the continuation.

Return Value

A YieldResult that indicates the success or failure of the yield operation.

Discussion

If nothing is awaiting the next value, this method attempts to buffer the result’s element.

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

See Also

Producing Elements