cool size asserts because perf lmao

This commit is contained in:
nora 2022-01-17 08:58:28 +01:00
parent ee0ccfcb3b
commit 83803959b6
4 changed files with 35 additions and 23 deletions

9
src/util.rs Normal file
View file

@ -0,0 +1,9 @@
/// Statically asserts that the size of the type is x bytes big (on 64-bit)
macro_rules! assert_size {
($name:ident == $size:expr) => {
#[cfg(target_pointer_width = "64")]
const _: [(); $size] = [(); ::std::mem::size_of::<$name>()];
};
}
pub(crate) use assert_size;