Fix MultiProducerSingleConsumerAsyncChannel doc examples to use takeChannel() (#460)

The stored channel property of ChannelAndStream is intentionally
internal, so the documented consume channelAndSource.channel snippet
fails to compile for clients. The supported API is takeChannel(); use
it in both doc examples.

Signed-off-by: Aniket <aniketkomailkro@gmail.com>
This commit is contained in:
Aniket authored and GitHub committed 2026-10-02 14:04:26 +02:00
1 parent 13713a4ffd
commit 822cfb8331
1 file changed
+4 -4
@@ -37,13 +37,13 @@ public struct MultiProducerSingleConsumerAsyncChannelAlreadyFinishedError: Error
/// Afterwards, you can pass the source to the producer and the channel to the consumer.
///
/// ```
/// let channelAndSource = MultiProducerSingleConsumerAsyncChannel.makeChannel(
/// var channelAndSource = MultiProducerSingleConsumerAsyncChannel.makeChannel(
/// of: Int.self,
/// backpressureStrategy: .watermark(low: 2, high: 4)
/// )
///
/// // The channel and source can be extracted from the returned type
/// let channel = consume channelAndSource.channel
/// let channel = channelAndSource.takeChannel()
/// let source = consume channelAndSource.source
/// ```
///
@@ -127,11 +127,11 @@ public struct MultiProducerSingleConsumerAsyncChannel<Element, Failure: Error>:
/// components from it.
///
/// ```swift
/// let channelAndSource = MultiProducerSingleConsumerAsyncChannel.makeChannel(
/// var channelAndSource = MultiProducerSingleConsumerAsyncChannel.makeChannel(
/// of: Int.self,
/// backpressureStrategy: .watermark(low: 5, high: 10)
/// )
/// var channel = consume channelAndSource.channel
/// var channel = channelAndSource.takeChannel()
/// var source = consume channelAndSource.source
/// ```
@frozen