Make ByteBuffer unconditionally use zero-copy for JSON Decoding (#1889)

This commit is contained in:
Peter Tolsma 2021-07-05 02:05:16 -05:00 committed by GitHub
parent d1b7c07883
commit 3f33ef369f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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)