Instance Method インスタンスメソッド

yield(with:)

Resume the task awaiting the next iteration point by having it return normally from its suspension point with a given result’s success value.

Declaration 宣言

@discardableResult func yield(with result: Result<Element, Never>) -> AsyncStream<Element>.Continuation.YieldResult

Parameters パラメータ

result

A result 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, the method attempts to buffer the result’s element.

If you call this method repeatedly, each call returns immediately, without blocking for any awaiting consumption from the iteration.

See Also 参照

Producing Elements