mirror of
https://github.com/apple/swift-nio
synced 2026-11-30 05:28:44 +00:00
Make ByteBuffer unconditionally use zero-copy for JSON Decoding (#1889)
This commit is contained in:
1 parent
d1b7c07883
commit
3f33ef369f
1 file changed
+1
-1
@@ -28,7 +28,7 @@ extension ByteBuffer {
|
||||
public func getJSONDecodable<T: Decodable>(_ type: T.Type,
|
||||
decoder: JSONDecoder = JSONDecoder(),
|
||||
at index: Int, length: Int) throws -> T? {
|
||||
guard let data = self.getData(at: index, length: length) else {
|
||||
guard let data = self.getData(at: index, length: length, byteTransferStrategy: .noCopy) else {
|
||||
return nil
|
||||
}
|
||||
return try decoder.decode(T.self, from: data)
|
||||
|
||||
Reference in new issue
Block a user