Guest User

Untitled

a guest
Aug 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #![feature(decl_macro)]
  2.  
  3. macro assert_type {
  4. ($ty:ty, $expected_size:expr) => {
  5. {
  6. fn _assert_type() {
  7. std::mem::transmute::<$ty, [u8; $expected_size]>;
  8. }
  9. }
  10. };
  11. }
  12.  
  13. fn main() {
  14. assert_type!(u64, 8);
  15. assert_type!(u32, 4);
  16. //bassert_type!(u16, 4);
  17. }
Add Comment
Please, Sign In to add comment