@@ -63,9 +63,9 @@ import Swift
63
63
/// }
64
64
///
65
65
/// To adapt this to use `async`-`await`, extend the `QuakeMonitor` to add a
66
- /// `quakes` property, of type `AsyncStream <Quake>`. In the getter for this
67
- /// property, return an `AsyncStream `, whose `build` closure -- called at
68
- /// runtime to create the stream -- does the following:
66
+ /// `quakes` property, of type `AsyncThrowingStream <Quake>`. In the getter for
67
+ /// this property, return an `AsyncThrowingStream `, whose `build` closure --
68
+ /// called at runtime to create the stream -- does the following:
69
69
///
70
70
/// 1. Creates a `QuakeMonitor` instance.
71
71
/// 2. Sets the monitor's `quakeHandler` property to a closure that receives
@@ -246,16 +246,16 @@ public struct AsyncThrowingStream<Element, Failure: Error> {
246
246
/// Constructs an asynchronous stream for an element type, using the
247
247
/// specified buffering policy and element-producing closure.
248
248
///
249
- /// - Parameter elementType: The type of element the `AsyncStream `
249
+ /// - Parameter elementType: The type of element the `AsyncThrowingStream `
250
250
/// produces
251
251
/// - Parameter maxBufferedElements: The maximum number of elements to
252
252
/// hold in the buffer. By default, this value is unlimited. Use a
253
253
/// `Continuation.BufferingPolicy` to buffer a specified number of oldest
254
254
/// or newest elements.
255
255
/// - Parameter build: A custom closure that yields values to the
256
- /// `AsyncStream `. This closure receives a `AsyncThrowingStream.Continuation`
257
- /// instance that it uses to provide elements to the stream and terminate the
258
- /// stream when finished.
256
+ /// `AsyncThrowingStream `. This closure receives an
257
+ /// `AsyncThrowingStream.Continuation` instance that it uses to provide
258
+ /// elements to the stream and terminate the stream when finished.
259
259
///
260
260
/// The `AsyncThrowingStream.Contuation` received by the `build` closure is
261
261
/// appopriate for use in concurrent contexts. It is thread safe to send and
@@ -363,15 +363,16 @@ extension AsyncThrowingStream: AsyncSequence {
363
363
/// The next value from the asynchronous stream.
364
364
///
365
365
/// When `next()` returns `nil`, this signifies the end of the
366
- /// `AsyncStream `.
366
+ /// `AsyncThrowingStream `.
367
367
///
368
- /// It is a programmer error to invoke `next()` from a
369
- /// concurrent context that contends with another such call, and this will
370
- /// result in a call to `fatalError()`.
368
+ /// It is a programmer error to invoke `next()` from a concurrent context
369
+ /// that contends with another such call, and this will result in a call to
370
+ /// `fatalError()`.
371
371
///
372
372
/// If you cancel the task this iterator is running in while `next()` is
373
- /// awaiting a value, the `AsyncStream` terminates. In this case, `next()`
374
- /// may return `nil` immediately, or else return `nil` on subseuqent calls.
373
+ /// awaiting a value, the `AsyncThrowingStream` terminates. In this case,
374
+ /// `next()` may return `nil` immediately, or else return `nil` on
375
+ /// subsequent calls.
375
376
public mutating func next( ) async throws -> Element ? {
376
377
return try await produce ( )
377
378
}
@@ -416,18 +417,18 @@ extension AsyncThrowingStream.Continuation {
416
417
}
417
418
}
418
419
419
- /// Resume the task awaiting the next iteration point by having it return
420
- /// nomally from its suspension point.
421
- ///
422
- /// - Returns: A `YieldResult` indicating the success or failure of the
423
- /// yield operation.
424
- ///
425
- /// Use this method with `AsyncStream ` instances whose `Element` type is
426
- /// `Void`. In this case, the `yield()` call simply unblocks the awaiting
427
- /// iteration; there is no value to return.
428
- ///
429
- /// If you call this method repeatedly, each call returns immediately, without
430
- /// blocking for any awaiting consumption from the iteration.
420
+ /// Resume the task awaiting the next iteration point by having it return
421
+ /// nomally from its suspension point.
422
+ ///
423
+ /// - Returns: A `YieldResult` indicating the success or failure of the
424
+ /// yield operation.
425
+ ///
426
+ /// Use this method with `AsyncThrowingStream ` instances whose `Element`
427
+ /// type is `Void`. In this case, the `yield()` call simply unblocks the
428
+ /// awaiting iteration; there is no value to return.
429
+ ///
430
+ /// If you call this method repeatedly, each call returns immediately,
431
+ /// without blocking for any awaiting consumption from the iteration.
431
432
@discardableResult
432
433
public func yield( ) -> YieldResult where Element == Void {
433
434
storage. yield ( ( ) )
0 commit comments