You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letmut bytes = BytesMut::with_capacity(32);unsafe{
bytes.set_len(16);}letmut rest = bytes.split_off(16);// unsafe {// rest.set_len(8);// }println!("{}", rest.capacity());// 16
bytes.unsplit(rest);println!("{}", bytes.capacity());// 16, but it should be 32
if I uncomment rest.set_len(8), the result would be right. I think the following logic is wrong. It just check length, the capacity should be checked too.
The text was updated successfully, but these errors were encountered:
songzhi
changed the title
unsplit a empty but with non-zero capacity BytesMut doesn't work
Unsplit an empty but with non-zero capacity BytesMut doesn't work
Aug 8, 2020
if I uncomment
rest.set_len(8)
, the result would be right. I think the following logic is wrong. It just check length, the capacity should be checked too.bytes/src/bytes_mut.rs
Lines 821 to 824 in 6fdb739
The text was updated successfully, but these errors were encountered: