[swift-users] When does `Data.init?(capacity:)` fail?
Adrian Zubarev
adrian.zubarev at devandartist.com
Fri Jun 17 13:38:19 CDT 2016
Hello there, I’m trying to optimize my code and reduce copying from different buffers into a new one.
I thought I just create a Data value with enough capacity and write directly into it. My problem is that Data.init?(capacity:) can fail, but why and when?
Can someone explain this behavior to me?
I’m sending data via TCP sockets and when recn function write directly into a Data struct.
--
Adrian Zubarev
Sent with Airmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160617/99f90682/attachment.html>
More information about the swift-users
mailing list