Skip to content

Commit f6e3df8

Browse files
author
Chris Adamson
committed
Async(Throwing)Stream style fixups.
1 parent db293ae commit f6e3df8

File tree

2 files changed

+27
-26
lines changed

2 files changed

+27
-26
lines changed

stdlib/public/Concurrency/AsyncStream.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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 subseuqent calls.
344+
/// may return `nil` immediately, or else return `nil` on subsequent calls.
345345
public mutating func next() async -> Element? {
346346
await produce()
347347
}

stdlib/public/Concurrency/AsyncThrowingStream.swift

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ import Swift
6363
/// }
6464
///
6565
/// 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:
6969
///
7070
/// 1. Creates a `QuakeMonitor` instance.
7171
/// 2. Sets the monitor's `quakeHandler` property to a closure that receives
@@ -246,16 +246,16 @@ public struct AsyncThrowingStream<Element, Failure: Error> {
246246
/// Constructs an asynchronous stream for an element type, using the
247247
/// specified buffering policy and element-producing closure.
248248
///
249-
/// - Parameter elementType: The type of element the `AsyncStream`
249+
/// - Parameter elementType: The type of element the `AsyncThrowingStream`
250250
/// produces
251251
/// - Parameter maxBufferedElements: The maximum number of elements to
252252
/// hold in the buffer. By default, this value is unlimited. Use a
253253
/// `Continuation.BufferingPolicy` to buffer a specified number of oldest
254254
/// or newest elements.
255255
/// - 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.
259259
///
260260
/// The `AsyncThrowingStream.Contuation` received by the `build` closure is
261261
/// appopriate for use in concurrent contexts. It is thread safe to send and
@@ -363,15 +363,16 @@ extension AsyncThrowingStream: AsyncSequence {
363363
/// The next value from the asynchronous stream.
364364
///
365365
/// When `next()` returns `nil`, this signifies the end of the
366-
/// `AsyncStream`.
366+
/// `AsyncThrowingStream`.
367367
///
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()`.
371371
///
372372
/// 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.
375376
public mutating func next() async throws -> Element? {
376377
return try await produce()
377378
}
@@ -416,18 +417,18 @@ extension AsyncThrowingStream.Continuation {
416417
}
417418
}
418419

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.
431432
@discardableResult
432433
public func yield() -> YieldResult where Element == Void {
433434
storage.yield(())

0 commit comments

Comments
 (0)