mirror of
https://github.com/apple/swift-nio
synced 2026-11-25 04:47:49 +00:00
Motivation: For Channel implementations, we implemented ChannelCore.unwrapData to allow them to unwrap a NIOAny into their expected data type. This remains our recommended flow, as Channels are supposed to know what data type they can send. However, in a few cases the Channel has a runtime type: in particular, EmbeddedChannel is capable of tolerating nearly anything. As we're coming to split the code apart, we'll likely want EmbeddedChannel to live in a different module than NIOCore. To that end, we need to add new API to ChannelCore to allow the specific EmbeddedChannel use-case. Modifications: - Implement ChannelCore.tryUnwrapData. - Use this within EmbeddedChannel. Result: EmbeddedChannel can attempt to unwrap things.