@@ -161,7 +161,7 @@ public struct MultiProducerSingleConsumerChannel<Element, Failure: Error>: ~Copy
161
161
of elementType: Element . Type = Element . self,
162
162
throwing failureType: Failure . Type = Never . self,
163
163
backpressureStrategy: Source . BackpressureStrategy
164
- ) -> ChannelAndStream {
164
+ ) -> sending ChannelAndStream {
165
165
let storage = _Storage (
166
166
backpressureStrategy: backpressureStrategy. internalBackpressureStrategy
167
167
)
@@ -209,7 +209,7 @@ extension MultiProducerSingleConsumerChannel {
209
209
/// A struct to send values to the channel.
210
210
///
211
211
/// Use this source to provide elements to the channel by calling one of the `send` methods.
212
- public struct Source : ~ Copyable, Sendable {
212
+ public struct Source : ~ Copyable {
213
213
/// A struct representing the backpressure of the channel.
214
214
public struct BackpressureStrategy : Sendable {
215
215
var internalBackpressureStrategy : _InternalBackpressureStrategy
@@ -234,8 +234,8 @@ extension MultiProducerSingleConsumerChannel {
234
234
/// - high: When the number of buffered elements rises above the high watermark, producers will be suspended.
235
235
/// - waterLevelForElement: A closure used to compute the contribution of each buffered element to the current water level.
236
236
///
237
- /// - Note, `waterLevelForElement` will be called on each element when it is written into the source and when
238
- /// it is consumed from the channel, so it is recommended to provide a function that runs in constant time.
237
+ /// - Important: `waterLevelForElement` will be called during a lock on each element when it is written into the source and when
238
+ /// it is consumed from the channel, so it must be side-effect free and at best constant in time.
239
239
public static func watermark(
240
240
low: Int ,
241
241
high: Int ,
@@ -446,7 +446,7 @@ extension MultiProducerSingleConsumerChannel {
446
446
public mutating func send< S> (
447
447
contentsOf sequence: consuming sending S
448
448
) async throws where Element == S . Element , S: Sequence , Element: Copyable {
449
- let syncSend : ( sending S, inout sending Self) throws -> SendResult = { try $1. send ( contentsOf: $0) }
449
+ let syncSend : ( sending S, inout Self ) throws -> SendResult = { try $1. send ( contentsOf: $0) }
450
450
let sendResult = try syncSend ( sequence, & self )
451
451
452
452
switch consume sendResult {
@@ -481,7 +481,7 @@ extension MultiProducerSingleConsumerChannel {
481
481
/// - element: The element to send to the channel.
482
482
@inlinable
483
483
public mutating func send( _ element: consuming sending Element) async throws {
484
- let syncSend : ( consuming sending Element, inout sending Self) throws -> SendResult = { try $1. send ( $0) }
484
+ let syncSend : ( consuming sending Element, inout Self ) throws -> SendResult = { try $1. send ( $0) }
485
485
let sendResult = try syncSend ( element, & self )
486
486
487
487
switch consume sendResult {
0 commit comments