Closed netvl closed 8 years ago
JPEG can't be reimplemented sensibly without BufReader
, and while GIF can be, I've eventually decided to always require BufRead
instead of just Read
. I don't think this would make any significant inconveniences (any reader could be wrapped into a BufReader
), however, this would be a performance win in many cases (lots of formats require skipping through large amounts of data, which is more performant with a buffered reader).
I've also added another method to LoadableMetadata
trait, read_from_seek()
, which accepts R: BufRead + Seek
and by default delegates to read<R: BufRead>()
; however, implementations may override it to provide more efficient parsing using seeking. This is already present in the master branch.
BufReader
is used internally in JPEG and GIF metadata parsers which may lead to surprising results. Ideally immeta should read as little as possible from the stream; ifBufRead
is used inside, it may read a lot more than necessary.