mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
Motivation: A while back we added a ChannelCore extension method that would allow removing handlers from a channel pipeline, in order to implement Channels outside of NIO. This extension worked well, but it did assume that you had a Channel to give it. There's no reason it needed a Channel instead of just a ChannelPipeline, but it was based on the assumption that Self would conform to Channel. Of course, this is usually true, but it turns out not to always be true, and EmbeddedChannel is one example where the Channel and ChannelCore are separate. To that end, we shouldn't require using the Channel here, just the ChannelPipeline. This will also let us force our NIO channels onto the public API, which will make migrating to NIOCore easier. Modifications: - Deprecate ChannelCore.removeHandlers(channel:) - Implement ChannelCore.removeHandlers(pipeline:) - Swap existing Channel implementations to use the new method. Result: More consistent usage of our APIs. Co-authored-by: George Barnett <gbarnett@apple.com>