Closed ExpHP closed 6 years ago
https://users.rust-lang.org/t/api-taking-r-bufread-versus-taking-r-read/13821
tl;dr this is not just a bad habit, but wrong, because it can cause the function to read more than necessary in cases like reading an XYZ frame from &mut File. These should be changed to take R: BufRead
&mut File
R: BufRead
I did this ages ago.
There is one place that still constructs a BufRead, but it forcibly reads to EOF for the above reasons. This is documented.
https://users.rust-lang.org/t/api-taking-r-bufread-versus-taking-r-read/13821
tl;dr this is not just a bad habit, but wrong, because it can cause the function to read more than necessary in cases like reading an XYZ frame from
&mut File
. These should be changed to takeR: BufRead