bincode icon indicating copy to clipboard operation
bincode copied to clipboard

`peek_read` should be `&mut self`, not `&self`

Open AlexApps99 opened this issue 3 years ago • 1 comments

I'm currently implementing Reader for a newtype over VecDeque.

To implement peek_read, I need to make the VecDeque contiguous with make_contiguous, which mutates in order to make the data a single contiguous slice.

I don't see any reason why peek_read should require being immutable, as every context I have seen it used in is followed by consume.

Would it be OK to change this in a PR?

AlexApps99 avatar Jun 20 '22 08:06 AlexApps99

👍 I see nothing wrong with peek_read taking &mut self

VictorKoenders avatar Jul 23 '22 09:07 VictorKoenders