@@ -115,29 +115,29 @@ import Swift
115
115
@available ( SwiftStdlib 5 . 5 , * )
116
116
public struct AsyncThrowingStream < Element, Failure: Error > {
117
117
118
- /// A mechanism to interface between synchronous code and an asynchronous
119
- /// stream.
120
- ///
121
- /// The closure you provide to the `AsyncThrowingStream` in
122
- /// `init(_:bufferingPolicy:_:)` receives an instance of this type when
123
- /// invoked. Use this continuation to provide elements to the stream by
124
- /// calling one of the `yield` methods, then terminate the stream normally by
125
- /// calling the `finish()` method. You can also use the continuation's
126
- /// `finish(throwing:)` method to terminate the stream by throwing an error.
127
- public struct Continuation : Sendable {
118
+ /// A mechanism to interface between synchronous code and an asynchronous
119
+ /// stream.
120
+ ///
121
+ /// The closure you provide to the `AsyncThrowingStream` in
122
+ /// `init(_:bufferingPolicy:_:)` receives an instance of this type when
123
+ /// invoked. Use this continuation to provide elements to the stream by
124
+ /// calling one of the `yield` methods, then terminate the stream normally by
125
+ /// calling the `finish()` method. You can also use the continuation's
126
+ /// `finish(throwing:)` method to terminate the stream by throwing an error.
127
+ public struct Continuation : Sendable {
128
128
/// A type that indicates how the stream terminated.
129
129
///
130
130
/// The `onTermination` closure receives an instance of this type.
131
131
public enum Termination {
132
132
133
- /// The stream finished as a result of calling the continuation's
134
- /// `finish` method.
135
- ///
136
- /// The associated `Failure` value provides the error that terminated
137
- /// the stream. If no error occurred, this value is `nil`.
133
+ /// The stream finished as a result of calling the continuation's
134
+ /// `finish` method.
135
+ ///
136
+ /// The associated `Failure` value provides the error that terminated
137
+ /// the stream. If no error occurred, this value is `nil`.
138
138
case finished( Failure ? )
139
139
140
- /// The stream finished as a result of cancellation.
140
+ /// The stream finished as a result of cancellation.
141
141
case cancelled
142
142
}
143
143
@@ -157,17 +157,18 @@ public struct AsyncThrowingStream<Element, Failure: Error> {
157
157
/// yield are mutually exclusive.
158
158
case enqueued( remaining: Int )
159
159
160
- /// The stream did not enqueue the element due to a full buffer.
160
+ /// The stream didn't enqueue the element due to a full buffer.
161
161
///
162
162
/// The associated element for this case is the element that the stream
163
163
/// dropped.
164
164
case dropped( Element )
165
165
166
- /// The stream did not enqueue the element because the stream was in a
167
- /// terminal state.
168
- ///
169
- /// This indicates the stream terminated prior to calling `yield`, either
170
- /// because the stream finished normally or through cancellation.
166
+ /// The stream didn't enqueue the element because the stream was in a
167
+ /// terminal state.
168
+ ///
169
+ /// This indicates the stream terminated prior to calling `yield`, either
170
+ /// because the stream finished normally or through cancellation, or
171
+ /// threw an error
171
172
case terminated
172
173
}
173
174
0 commit comments