From f451f435c5cf396128bf95d1bd1e9a064dab4a8d Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Tue, 30 Sep 2025 14:59:12 +0200 Subject: [PATCH 1/2] Allow channel writes to be just sending and not Sendable --- Sources/NIOCore/Channel.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/NIOCore/Channel.swift b/Sources/NIOCore/Channel.swift index d86362f6e9..350f171cc4 100644 --- a/Sources/NIOCore/Channel.swift +++ b/Sources/NIOCore/Channel.swift @@ -158,12 +158,22 @@ public protocol Channel: AnyObject, ChannelOutboundInvoker, _NIOPreconcurrencySe @preconcurrency func write(_ any: T) -> EventLoopFuture + /// Write data into the `Channel`, automatically wrapping with `NIOAny`. + /// + /// - seealso: `ChannelOutboundInvoker.write`. + func write(_ any: sending T) -> EventLoopFuture + /// Write data into the `Channel`, automatically wrapping with `NIOAny`. /// /// - seealso: `ChannelOutboundInvoker.write`. @preconcurrency func write(_ any: T, promise: EventLoopPromise?) + /// Write data into the `Channel`, automatically wrapping with `NIOAny`. + /// + /// - seealso: `ChannelOutboundInvoker.write`. + func write(_ any: sending T, promise: EventLoopPromise?) + /// Write and flush data into the `Channel`, automatically wrapping with `NIOAny`. /// /// - seealso: `ChannelOutboundInvoker.writeAndFlush`. From 5e5645cc17399cc9c343dbd2db56bbdba5ecbd27 Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Tue, 30 Sep 2025 15:38:50 +0200 Subject: [PATCH 2/2] use compiler ifs --- Sources/NIOCore/Channel.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/NIOCore/Channel.swift b/Sources/NIOCore/Channel.swift index 350f171cc4..58ef2332b2 100644 --- a/Sources/NIOCore/Channel.swift +++ b/Sources/NIOCore/Channel.swift @@ -158,10 +158,12 @@ public protocol Channel: AnyObject, ChannelOutboundInvoker, _NIOPreconcurrencySe @preconcurrency func write(_ any: T) -> EventLoopFuture + #if compiler(>=6.0) /// Write data into the `Channel`, automatically wrapping with `NIOAny`. /// /// - seealso: `ChannelOutboundInvoker.write`. func write(_ any: sending T) -> EventLoopFuture + #endif /// Write data into the `Channel`, automatically wrapping with `NIOAny`. /// @@ -169,10 +171,12 @@ public protocol Channel: AnyObject, ChannelOutboundInvoker, _NIOPreconcurrencySe @preconcurrency func write(_ any: T, promise: EventLoopPromise?) + #if compiler(>=6.0) /// Write data into the `Channel`, automatically wrapping with `NIOAny`. /// /// - seealso: `ChannelOutboundInvoker.write`. func write(_ any: sending T, promise: EventLoopPromise?) + #endif /// Write and flush data into the `Channel`, automatically wrapping with `NIOAny`. ///