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
11
12
13
14
//! A pointer is not read as a pointer by `pun_ref`, even one of the same type: only `view_ref`
//! proves what a pointer aims at.
#[path = "../support/relative.rs"]
#[allow(dead_code)]
mod relative;
use relative::One;

fn read(pointer: &One<u32>) -> &One<[u8; 4]> {
  puns::pun_ref(pointer)
}

fn main() {
  let _: fn(&One<u32>) -> &One<[u8; 4]> = read;
}