When chaining two spacious buffers, as in unbounded BytesMut, the remaining and remaining_mut fn both panic due to overflow when adding together the two child remaining. Obviously BytesMut acts as though it is infinite and this happens. I don't know if I'm dumb for chaining two infinite buffers, but it was just the simple way for me to start testing out Bytes and a Chain. The fix is of course simple, just change the unwrap to unwrap_or(usize::MAX).
When chaining two spacious buffers, as in unbounded BytesMut, the
remaining
andremaining_mut
fn both panic due to overflow when adding together the two childremaining
. Obviously BytesMut acts as though it is infinite and this happens. I don't know if I'm dumb for chaining two infinite buffers, but it was just the simple way for me to start testing out Bytes and a Chain. The fix is of course simple, just change theunwrap
tounwrap_or(usize::MAX)
.