Skip to content

Light edit of recent doc comments (rdar://90176127) #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/AsyncAlgorithms/AsyncJoinedBySeparatorSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
//===----------------------------------------------------------------------===//

extension AsyncSequence where Element: AsyncSequence {
/// Concatenate an `AsyncSequence` of `AsyncSequence` elements with a seperator.
/// Concatenate an `AsyncSequence` of `AsyncSequence` elements with a separator.
@inlinable
public func joined<Separator: AsyncSequence>(separator: Separator) -> AsyncJoinedBySeparatorSequence<Self, Separator> {
return AsyncJoinedBySeparatorSequence(self, separator: separator)
}
}

/// An `AsyncSequence` that concatenates`AsyncSequence` elements with a seperator.
/// An `AsyncSequence` that concatenates `AsyncSequence` elements with a separator.
public struct AsyncJoinedBySeparatorSequence<Base: AsyncSequence, Separator: AsyncSequence>: AsyncSequence where Base.Element: AsyncSequence, Separator.Element == Base.Element.Element {
public typealias Element = Base.Element.Element
public typealias AsyncIterator = Iterator
Expand Down
4 changes: 2 additions & 2 deletions Sources/AsyncAlgorithms/AsyncRemoveDuplicatesSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extension AsyncSequence {
return AsyncRemoveDuplicatesSequence(self, predicate: predicate)
}

/// Creates an asynchronous sequence that omits repeated elements by testing them with a predicate.
/// Creates an asynchronous sequence that omits repeated elements by testing them with an error-throwing predicate.
public func removeDuplicates(by predicate: @escaping @Sendable (Element, Element) async throws -> Bool) -> AsyncThrowingRemoveDuplicatesSequence<Self> {
return AsyncThrowingRemoveDuplicatesSequence(self, predicate: predicate)
}
Expand Down Expand Up @@ -89,7 +89,7 @@ extension AsyncRemoveDuplicatesSequence: Sendable where Base: Sendable, Base.Ele
extension AsyncRemoveDuplicatesSequence.Iterator: Sendable where Base: Sendable, Base.Element: Sendable, Base.AsyncIterator: Sendable { }


/// An asynchronous sequence that omits repeated elements by testing them with a predicate.
/// An asynchronous sequence that omits repeated elements by testing them with an error-throwing predicate.
public struct AsyncThrowingRemoveDuplicatesSequence<Base: AsyncSequence>: AsyncSequence {
public typealias Element = Base.Element

Expand Down
10 changes: 5 additions & 5 deletions Sources/AsyncAlgorithms/AsyncThrottleSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
//===----------------------------------------------------------------------===//

extension AsyncSequence {
/// Create a rate limited `AsyncSequence` by emitting values at most every specified interval.
/// Create a rate-limited `AsyncSequence` by emitting values at most every specified interval.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
public func throttle<C: Clock, Reduced>(for interval: C.Instant.Duration, clock: C, reducing: @Sendable @escaping (Reduced?, Element) async -> Reduced) -> AsyncThrottleSequence<Self, C, Reduced> {
AsyncThrottleSequence(self, interval: interval, clock: clock, reducing: reducing)
}

/// Create a rate limited `AsyncSequence` by emitting values at most every specified interval.
/// Create a rate-limited `AsyncSequence` by emitting values at most every specified interval.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
public func throttle<Reduced>(for interval: Duration, reducing: @Sendable @escaping (Reduced?, Element) async -> Reduced) -> AsyncThrottleSequence<Self, ContinuousClock, Reduced> {
throttle(for: interval, clock: .continuous, reducing: reducing)
}

/// Create a rate limited `AsyncSequence` by emitting values at most every specified interval.
/// Create a rate-limited `AsyncSequence` by emitting values at most every specified interval.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
public func throttle<C: Clock>(for interval: C.Instant.Duration, clock: C, latest: Bool = true) -> AsyncThrottleSequence<Self, C, Element> {
throttle(for: interval, clock: clock) { previous, element in
Expand All @@ -34,14 +34,14 @@ extension AsyncSequence {
}
}

/// Create a rate limited `AsyncSequence` by emitting values at most every specified interval.
/// Create a rate-limited `AsyncSequence` by emitting values at most every specified interval.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
public func throttle(for interval: Duration, latest: Bool = true) -> AsyncThrottleSequence<Self, ContinuousClock, Element> {
throttle(for: interval, clock: .continuous, latest: latest)
}
}

/// A rate limited `AsyncSequence` by emitting values at most every specified interval.
/// A rate-limited `AsyncSequence` by emitting values at most every specified interval.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
public struct AsyncThrottleSequence<Base: AsyncSequence, C: Clock, Reduced> {
let base: Base
Expand Down
4 changes: 2 additions & 2 deletions Sources/AsyncAlgorithms/AsyncThrowingChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
//
//===----------------------------------------------------------------------===//

/// A throwing channel for sending elements from on task to another with back pressure.
/// An error-throwing channel for sending elements from on task to another with back pressure.
///
/// The `AsyncThrowingChannel` class is intended to be used as a communication types between tasks., particularly when one task produces values and another task consumes those values. The back pressure applied by `send(_:)`, `fail(_:)` and `finish()` via the suspension/resume ensure that the production of values does not exceed the consumption of values from iteration. Each of these methods suspends after enqueuing the event and is resumed when the next call to `next()` on the `Iterator` is made.
/// The `AsyncThrowingChannel` class is intended to be used as a communication types between tasks, particularly when one task produces values and another task consumes those values. The back pressure applied by `send(_:)`, `fail(_:)` and `finish()` via suspension/resume ensures that the production of values does not exceed the consumption of values from iteration. Each of these methods suspends after enqueuing the event and is resumed when the next call to `next()` on the `Iterator` is made.
public final class AsyncThrowingChannel<Element: Sendable, Failure: Error>: AsyncSequence, Sendable {
/// The iterator for an `AsyncThrowingChannel` instance.
public struct Iterator: AsyncIteratorProtocol, Sendable {
Expand Down
4 changes: 2 additions & 2 deletions Sources/AsyncAlgorithms/AsyncZip2Sequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//===----------------------------------------------------------------------===//

/// Creates an asynchronous sequence that concurrently awaits values from two `AsyncSequence` types
/// by emitting a tuple of the values.
/// and emits a tuple of the values.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this (and others like this) if I've changed meaning, but it didn't make sense to me to say the sequence "concurrently awaits… by emitting". I think it awaits the other sequences, and then emits tuples as the source sequences produce values.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me too.

public func zip<Base1: AsyncSequence, Base2: AsyncSequence>(_ base1: Base1, _ base2: Base2) -> AsyncZip2Sequence<Base1, Base2>
where Base1: Sendable,
Base2: Sendable,
Expand All @@ -22,7 +22,7 @@ public func zip<Base1: AsyncSequence, Base2: AsyncSequence>(_ base1: Base1, _ ba
}

/// An asynchronous sequence that concurrently awaits values from two `AsyncSequence` types
/// by emitting a tuple of the values.
/// and emits a tuple of the values.
public struct AsyncZip2Sequence<Base1: AsyncSequence, Base2: AsyncSequence>: Sendable
where Base1: Sendable,
Base2: Sendable,
Expand Down
4 changes: 2 additions & 2 deletions Sources/AsyncAlgorithms/AsyncZip3Sequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//===----------------------------------------------------------------------===//

/// Creates an asynchronous sequence that concurrently awaits values from three `AsyncSequence` types
/// by emitting a tuple of the values.
/// and emits a tuple of the values.
public func zip<Base1: AsyncSequence, Base2: AsyncSequence, Base3: AsyncSequence>(_ base1: Base1, _ base2: Base2, _ base3: Base3) -> AsyncZip3Sequence<Base1, Base2, Base3>
where Base1: Sendable,
Base2: Sendable,
Expand All @@ -25,7 +25,7 @@ public func zip<Base1: AsyncSequence, Base2: AsyncSequence, Base3: AsyncSequence
}

/// An asynchronous sequence that concurrently awaits values from three `AsyncSequence` types
/// by emitting a tuple of the values.
/// and emits a tuple of the values.
public struct AsyncZip3Sequence<Base1: AsyncSequence, Base2: AsyncSequence, Base3: AsyncSequence>: Sendable
where Base1: Sendable,
Base2: Sendable,
Expand Down