How to avoid copying data and make use of discontiguous data?

Hello, I am working on networking code with a need to assemble Data objects together. I was expecting DispatchData to allow me to append the Data objects storage as new data regions of the dispatch data object without causing a copy, but to my surprise DispatchData does not have an append(data: Data) method. I receive the Data objects from APIs out of my control so I cannot change the fact that their type is Data.

Is there any solution other than writing a new type of my own that conforms to DataProtocol and allows to add new data regions out of existing Data objects?

Is there any good reason for DispatchData to not allow to do that already?

Terms of Service

Privacy Policy

Cookie Policy