Skip to content

Commit

Permalink
Merge pull request #92 from nickbabcock/assert
Browse files Browse the repository at this point in the history
Add debug assertion to communicate invariant
  • Loading branch information
nickbabcock authored Nov 7, 2024
2 parents b884bfb + fd5b114 commit 91cabd6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ impl HashPacket {

#[inline]
pub fn set_to(&mut self, data: &[u8]) {
debug_assert!(data.len() < PACKET_SIZE, "data large enough to process packet");
self.buf_index = data.len();
if !data.is_empty() {
self.buf[..data.len()].copy_from_slice(data);
Expand Down

0 comments on commit 91cabd6

Please sign in to comment.