fn maybe_read_in_chunks<R: Read + ?Sized>(
len: usize,
r: &mut R,
) -> Result<Vec<u8>, Error>Expand description
Reads data from the reader r in chunks if the length len exceeds a predefined chunk size.
This approach avoids preallocating a large buffer upfront, which is crucial for handling potentially large or untrusted input sizes efficiently and safely.