In Rust v1.37, the BufReader
and BufWriter
structs both added a buffer() -> &[u8]
method that allowed users to access the struct's buffer directly without attempting to refill it (as fill_buf() -> &[u8]
does).
I was surprised to see that this method was not also added to the BufRead
trait. A user noted this on the tracking issue, but the change was merged and the issue closed out without further discussion.
Since trait specialization isn't stable yet, it's not possible leverage buffer()
in blanket trait implementations. Is there a good reason not to add this to BufRead
?