 @available(SwiftStdlib 5.1, *)
 extension AsyncThrowingStream.Continuation {
   /// Resume the task awaiting the next iteration point by having it return
-  /// normally from its suspension point or buffer the value if no awaiting
-  /// next iteration is active.
-  ///
-  /// - Parameter result: A result to yield from the continuation.
-  ///
-  /// This can be called more than once and returns to the caller immediately
-  /// without blocking for any awaiting consuption from the iteration.
+  /// normally or throw, based on a given result.
+  ///
+  /// - Parameter result: A result to yield from the continuation. In the
+  ///   `.success(_:)` case, this returns the associated value from the
+  ///   iterator's `next()` method. If the result is the `failure(_:)` case,
+  ///   this call terminates the stream with the result's error, by calling
+  ///   `finish(throwing:)`.
+  /// - Returns: A `YieldResult` that indicates the success or failure of the
+  ///   yield operation.
+  ///
+  /// If nothing is awaiting the next value and the result is success, this call
+  /// attempts to buffer the result's element.
+  ///
+  /// If you call this method repeatedly, each call returns immediately, without
+  /// blocking for any awaiting consumption from the iteration.
   @discardableResult
   public func yield(
     with result: Result<Element, Failure>


  let produce: () async throws -> Element?

  /// Construct a AsyncThrowingStream buffering given an Element type.
  ///
  /// - Parameter elementType: The type the AsyncStream will produce.
  /// - Parameter maxBufferedElements: The maximum number of elements to
  ///   hold in the buffer past any checks for continuations being resumed.
  /// - Parameter build: The work associated with yielding values to the 
  ///   AsyncStream.
  ///
  /// The maximum number of pending elements limited by dropping the oldest
  /// value when a new value comes in if the buffer would excede the limit
  /// placed upon it. By default this limit is unlimited.
  ///
  /// The build closure passes in a Continuation which can be used in
  /// concurrent contexts. It is thread safe to send and finish; all calls
  /// to the continuation are serialized, however calling this from multiple
  /// concurrent contexts could result in out of order delivery.
  public init(
    _ elementType: Element.Type = Element.self,
    bufferingPolicy limit: Continuation.BufferingPolicy = .unbounded,


@available(SwiftStdlib 5.1, *)
extension AsyncThrowingStream: AsyncSequence {
  /// The asynchronous iterator for iterating an asynchronous stream.
  ///
  /// This type is not `Sendable`. Don't use it from multiple
  /// concurrent contexts. It is a programmer error to invoke `next()` from a
  /// concurrent context that contends with another such call, which
  /// results in a call to `fatalError()`.
  public struct Iterator: AsyncIteratorProtocol {
    let produce: () async throws -> Element?

    /// The next value from the asynchronous stream.
    ///
    /// When `next()` returns `nil`, this signifies the end of the
    /// `AsyncThrowingStream`.
    ///
    /// It is a programmer error to invoke `next()` from a concurrent context
    /// that contends with another such call, which results in a call to
    ///  `fatalError()`.
    ///
    /// If you cancel the task this iterator is running in while `next()` is
    /// awaiting a value, the `AsyncThrowingStream` terminates. In this case,
    /// `next()` may return `nil` immediately, or else return `nil` on
    /// subsequent calls.
    public mutating func next() async throws -> Element? {
      return try await produce()
    }
  }

  /// Creates the asynchronous iterator that produces elements of this
  /// asynchronous sequence.
  public func makeAsyncIterator() -> Iterator {
    return Iterator(produce: produce)
  }
