Skip to content

Commit cf123b8

Browse files
Apply Alex's suggestions from code review
Co-authored-by: Alex Martini <[email protected]>
1 parent be6d761 commit cf123b8

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

stdlib/public/Concurrency/AsyncStream.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import Swift
2626
/// them to the stream by calling the continuation's `yield(_:)` method. When
2727
/// there are no further elements to produce, call the continuation's
2828
/// `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
3030
/// calling it from concurrent contexts external to the iteration of the
3131
/// `AsyncStream`.
3232
///
@@ -83,7 +83,7 @@ import Swift
8383
/// }
8484
/// }
8585
///
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
8787
/// `for`-`await`-`in` syntax to process each `Quake` instance as the stream
8888
/// produces it:
8989
///
@@ -154,12 +154,12 @@ public struct AsyncStream<Element> {
154154

155155
/// When the buffer is full, discard the newly received element.
156156
///
157-
/// This strategy enforces keeping the specified amount of oldest values.
157+
/// This strategy enforces keeping the specified number of oldest values.
158158
case bufferingOldest(Int)
159159

160160
/// When the buffer is full, discard the oldest element in the buffer.
161161
///
162-
/// This strategy enforces keeping the specified amount of newest values.
162+
/// This strategy enforces keeping the specified number of newest values.
163163
case bufferingNewest(Int)
164164
}
165165

@@ -199,7 +199,7 @@ public struct AsyncStream<Element> {
199199
/// terminate iteration of a `AsyncStream` results in a call to this
200200
/// callback.
201201
///
202-
/// Cancelling an active iteration invokes the `onTermination` callback
202+
/// Canceling an active iteration invokes the `onTermination` callback
203203
/// first, then resumes by yielding `nil`. This means that you can perform
204204
/// needed cleanup in the cancellation handler. After reaching a terminal
205205
/// state, the `AsyncStream` disposes of the callback.
@@ -219,7 +219,7 @@ public struct AsyncStream<Element> {
219219
/// specified buffering policy and element-producing closure.
220220
///
221221
/// - Parameter elementType: The type of element the `AsyncStream`
222-
/// produces
222+
/// produces.
223223
/// - Parameter limit: The maximum number of elements to hold in the buffer.
224224
/// By default, this value is unlimited. Use a
225225
/// `Continuation.BufferingPolicy` to buffer a specified number of oldest
@@ -232,7 +232,7 @@ public struct AsyncStream<Element> {
232232
/// The `AsyncStream.Contuation` received by the `build` closure is appopriate
233233
/// for use in concurrent contexts. It is thread safe to send and finish; all
234234
/// 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.
236236
///
237237
/// The following example shows an `AsyncStream` created with this
238238
/// initializer that produces random numbers on a one-second interval. When
@@ -242,7 +242,7 @@ public struct AsyncStream<Element> {
242242
/// let stream = AsyncStream<Int>(
243243
/// Int.self, bufferingPolicy: .bufferingNewest(5)) { continuation in
244244
/// Task.detached {
245-
/// while (keepRunning) {
245+
/// while keepRunning {
246246
/// await Task.sleep(1 * 1_000_000_000)
247247
/// continuation.yield(Int.random(in: 1...10))
248248
/// }
@@ -270,7 +270,7 @@ public struct AsyncStream<Element> {
270270
///
271271
/// - Parameters:
272272
/// - produce: A closure that asynchronously produces elements for the
273-
/// stream.
273+
/// stream.
274274
/// - onCancel: A closure to execute when cancelling the stream's task.
275275
///
276276
/// Use this convenience initializer when you have an asychronous function
@@ -323,7 +323,7 @@ public struct AsyncStream<Element> {
323323
extension AsyncStream: AsyncSequence {
324324
/// The asynchronous iterator for iterating an asynchronous stream.
325325
///
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
327327
/// concurrent contexts. It is a programmer error to invoke `next()` from a
328328
/// concurrent context that contends with another such call, and this will
329329
/// result in a call to `fatalError()`.
@@ -341,7 +341,7 @@ extension AsyncStream: AsyncSequence {
341341
///
342342
/// If you cancel the task this iterator is running in while `next()` is
343343
/// 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.
345345
public mutating func next() async -> Element? {
346346
await produce()
347347
}

0 commit comments

Comments
 (0)