Make ByteBuffer unconditionally use zero-copy for JSON Decoding (#1889)
This commit is contained in:
parent
d1b7c07883
commit
3f33ef369f
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue