mirror of
https://github.com/apple/swift-async-algorithms
synced 2026-11-28 04:54:20 +00:00
Minor documentation improvements (#153)
This commit is contained in:
1 parent
d185b2068b
commit
6b59cfb8d0
2 files changed
+5
-4
No files matched your search
@@ -13,10 +13,10 @@
|
||||
///
|
||||
/// The `AsyncChannel` class is intended to be used as a communication type between tasks,
|
||||
/// particularly when one task produces values and another task consumes those values. The back
|
||||
/// pressure applied by `send(_:)` 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.
|
||||
/// pressure applied by `send(_:)` and `finish()` via the 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 AsyncChannel<Element: Sendable>: AsyncSequence, Sendable {
|
||||
/// The iterator for a `AsyncChannel` instance.
|
||||
public struct Iterator: AsyncIteratorProtocol, Sendable {
|
||||
|
||||
@@ -37,6 +37,7 @@ extension AsyncSequence {
|
||||
/// error, `AsyncChunkedByGroupSequence` will rethrow that error immediately and discard
|
||||
/// any current group.
|
||||
///
|
||||
/// let numbers = [10, 20, 30, 10, 40, 40, 10, 20].async
|
||||
/// let chunks = numbers.chunked { $0 <= $1 }
|
||||
/// for await numberChunk in chunks {
|
||||
/// print(numberChunk)
|
||||
|
||||
Reference in new issue
Block a user