mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
Motivation: Per SR-10219, Data does not implement withContiguousStorageWithAvailable and the maintainers do not believe it can. This forces code that writes Data into ByteBuffers into slow-paths. Given that Data conforms to ContiguousBytes and DataProtocol, we can arrange to serve a number of use-cases by providing fast paths for all conforming types. This makes it easier to use types vended by other Foundation-using libraries, such as Swift Crypto. Modifications: - Implement `writeContiguousBytes` and `setContiguousBytes`. - Implement `writeData` and `setData` for `DataProtocol` implementations Result: Better support for writing `Data` and friends into `ByteBuffer`s.