Skip to content

Instantly share code, notes, and snippets.

Created August 15, 2016 19:00
Show Gist options
  • Save anonymous/a38193f44820b328d49dbddeb827e831 to your computer and use it in GitHub Desktop.
Save anonymous/a38193f44820b328d49dbddeb827e831 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
#[derive(Debug)]
struct S {
i: [u8]
}
fn main() {
let b = "Host: ".as_bytes();
let p: *const [u8] = b;
let s: *const S = p as *const S;
let v: &S = unsafe { &*s };
println!("{:?}", v);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment