Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![feature(decl_macro)]
- macro assert_type {
- ($ty:ty, $expected_size:expr) => {
- {
- fn _assert_type() {
- std::mem::transmute::<$ty, [u8; $expected_size]>;
- }
- }
- };
- }
- fn main() {
- assert_type!(u64, 8);
- assert_type!(u32, 4);
- //bassert_type!(u16, 4);
- }
Add Comment
Please, Sign In to add comment