BufferingPolicy
A strategy that handles exhaustion of a buffer’s capacity.
- iOS
- 13.0+
- macOS
- 10.15+
- tvOS
- 13.0+
- watchOS
- 6.0+
enum BufferingPolicyA strategy that handles exhaustion of a buffer’s capacity.
enum BufferingPolicyimport _Concurrencystruct ContinuationA mechanism to interface between synchronous code and an asynchronous stream.
struct AsyncThrowingStream<Element, Failure> where Failure : ErrorAn asynchronous sequence generated from an error-throwing closure that calls a continuation to produce new elements.
case bufferingNewest(Int)When the buffer is full, discard the oldest element in the buffer.
case bufferingOldest(Int)When the buffer is full, discard the newly received element.
case unboundedContinue to add to the buffer, treating its capacity as infinite.
var onTermination: ((AsyncThrowingStream<Element, Failure>.Continuation.Termination) -> Void)? { get nonmutating set }A callback to invoke when canceling iteration of an asynchronous stream.
func finish(throwing error: Failure? = nil) Resume the task awaiting the next iteration point by having it return nil, which signifies the end of the iteration.
@discardableResult func yield(_ value: sending Element) -> AsyncThrowingStream<Element, Failure>.Continuation.YieldResult Resume the task awaiting the next iteration point by having it return normally from its suspension point with a given element.
enum TerminationA type that indicates how the stream terminated.
enum YieldResultA type that indicates the result of yielding a value to a client, by way of the continuation.
protocol SendableA thread-safe type whose values can be shared across arbitrary concurrent contexts without introducing a risk of data races. Values of the type may have no shared mutable state, or they may protect that state with a lock or by forcing it to only be accessed from a specific actor.