Add an important assert

This commit is contained in:
Adam Ierymenko 2022-12-16 11:10:31 -05:00
parent a5dfa45797
commit d415f1c31b

View file

@ -71,5 +71,6 @@ pub fn as_byte_array<T: Copy, const S: usize>(o: &T) -> &[u8; S] {
#[inline(always)]
pub fn to_byte_array<T: Copy, const S: usize>(o: T) -> [u8; S] {
assert_eq!(S, size_of::<T>());
assert!(!std::mem::needs_drop::<T>());
unsafe { *(&o as *const T).cast() }
}