puns 0.1.5

Type punning proven at compile time: a safe alternative to transmute and to hand-written parsing of bytes
Documentation
1
2
3
4
5
6
7
8
9
10
// An enum without `repr`: its tag is one byte, and the byte after it is padding in `B`.
#[derive(puns::Pun, Clone, Copy)]
enum Direct {
  A(u8),
  B(u16),
}

fn main() {
  let _: [u8; 4] = puns::pun(Direct::B(1));
}