Skip to content

Commit

Permalink
add debug assertions for len
Browse files Browse the repository at this point in the history
  • Loading branch information
braddunbar committed Apr 9, 2024
1 parent 6744316 commit f92c9f6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/bytes_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ impl BytesMut {
// Update the info
self.ptr = vptr(v.as_mut_ptr().add(off));
self.cap = v.capacity() - off;
debug_assert_eq!(self.len, v.len() - off);
}

return;
Expand Down Expand Up @@ -746,6 +747,7 @@ impl BytesMut {
self.data = invalid_ptr(data);
self.ptr = vptr(v.as_mut_ptr());
self.cap = v.capacity();
debug_assert_eq!(self.len, v.len());
}

/// Appends given bytes to this `BytesMut`.
Expand Down

0 comments on commit f92c9f6

Please sign in to comment.