@@ -26,7 +26,7 @@ import Swift
26
26
/// them to the stream by calling the continuation's `yield(_:)` method. When
27
27
/// there are no further elements to produce, call the continuation's
28
28
/// `finish()` method. This causes the sequence iterator to produce a `nil`,
29
- /// which terminates the sequence. The continuation is `Sendable`, which permits
29
+ /// which terminates the sequence. The continuation conforms to `Sendable`, which permits
30
30
/// calling it from concurrent contexts external to the iteration of the
31
31
/// `AsyncStream`.
32
32
///
@@ -83,7 +83,7 @@ import Swift
83
83
/// }
84
84
/// }
85
85
///
86
- /// Since the stream is an `AsyncSequence`, the call point can use the
86
+ /// Because the stream is an `AsyncSequence`, the call point can use the
87
87
/// `for`-`await`-`in` syntax to process each `Quake` instance as the stream
88
88
/// produces it:
89
89
///
@@ -154,12 +154,12 @@ public struct AsyncStream<Element> {
154
154
155
155
/// When the buffer is full, discard the newly received element.
156
156
///
157
- /// This strategy enforces keeping the specified amount of oldest values.
157
+ /// This strategy enforces keeping the specified number of oldest values.
158
158
case bufferingOldest( Int )
159
159
160
160
/// When the buffer is full, discard the oldest element in the buffer.
161
161
///
162
- /// This strategy enforces keeping the specified amount of newest values.
162
+ /// This strategy enforces keeping the specified number of newest values.
163
163
case bufferingNewest( Int )
164
164
}
165
165
@@ -199,7 +199,7 @@ public struct AsyncStream<Element> {
199
199
/// terminate iteration of a `AsyncStream` results in a call to this
200
200
/// callback.
201
201
///
202
- /// Cancelling an active iteration invokes the `onTermination` callback
202
+ /// Canceling an active iteration invokes the `onTermination` callback
203
203
/// first, then resumes by yielding `nil`. This means that you can perform
204
204
/// needed cleanup in the cancellation handler. After reaching a terminal
205
205
/// state, the `AsyncStream` disposes of the callback.
@@ -219,7 +219,7 @@ public struct AsyncStream<Element> {
219
219
/// specified buffering policy and element-producing closure.
220
220
///
221
221
/// - Parameter elementType: The type of element the `AsyncStream`
222
- /// produces
222
+ /// produces.
223
223
/// - Parameter limit: The maximum number of elements to hold in the buffer.
224
224
/// By default, this value is unlimited. Use a
225
225
/// `Continuation.BufferingPolicy` to buffer a specified number of oldest
@@ -232,7 +232,7 @@ public struct AsyncStream<Element> {
232
232
/// The `AsyncStream.Contuation` received by the `build` closure is appopriate
233
233
/// for use in concurrent contexts. It is thread safe to send and finish; all
234
234
/// calls are to the continuation are serialized, however calling this from
235
- /// multiple concurrent contexts could result in out of order delivery.
235
+ /// multiple concurrent contexts could result in out-of- order delivery.
236
236
///
237
237
/// The following example shows an `AsyncStream` created with this
238
238
/// initializer that produces random numbers on a one-second interval. When
@@ -242,7 +242,7 @@ public struct AsyncStream<Element> {
242
242
/// let stream = AsyncStream<Int>(
243
243
/// Int.self, bufferingPolicy: .bufferingNewest(5)) { continuation in
244
244
/// Task.detached {
245
- /// while ( keepRunning) {
245
+ /// while keepRunning {
246
246
/// await Task.sleep(1 * 1_000_000_000)
247
247
/// continuation.yield(Int.random(in: 1...10))
248
248
/// }
@@ -270,7 +270,7 @@ public struct AsyncStream<Element> {
270
270
///
271
271
/// - Parameters:
272
272
/// - produce: A closure that asynchronously produces elements for the
273
- /// stream.
273
+ /// stream.
274
274
/// - onCancel: A closure to execute when cancelling the stream's task.
275
275
///
276
276
/// Use this convenience initializer when you have an asychronous function
@@ -323,7 +323,7 @@ public struct AsyncStream<Element> {
323
323
extension AsyncStream : AsyncSequence {
324
324
/// The asynchronous iterator for iterating an asynchronous stream.
325
325
///
326
- /// This type is specificially not `Sendable`. Do not use it from multiple
326
+ /// This type specifically doesn't conform to `Sendable`. Do not use it from multiple
327
327
/// concurrent contexts. It is a programmer error to invoke `next()` from a
328
328
/// concurrent context that contends with another such call, and this will
329
329
/// result in a call to `fatalError()`.
@@ -341,7 +341,7 @@ extension AsyncStream: AsyncSequence {
341
341
///
342
342
/// If you cancel the task this iterator is running in while `next()` is
343
343
/// awaiting a value, the `AsyncStream` terminates. In this case, `next()`
344
- /// may return `nil` immediately, or else return `nil` on subsequent calls.
344
+ /// might return `nil` immediately, or might return `nil` on subsequent calls.
345
345
public mutating func next( ) async -> Element ? {
346
346
await produce ( )
347
347
}
0 commit comments