From fd5b1149a3e9aef80109b84eae904fc46f952cf2 Mon Sep 17 00:00:00 2001 From: Nick Babcock Date: Thu, 7 Nov 2024 06:58:58 -0600 Subject: [PATCH] Add debug assertion to communicate invariant --- src/internal.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/internal.rs b/src/internal.rs index 5e5aa29..b507729 100644 --- a/src/internal.rs +++ b/src/internal.rs @@ -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);