Created
December 31, 2014 22:51
-
-
Save rrichardson/24fcd70dc3f5924a901b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsafe fn struct_to_bytes<T>(t: &T) -> &[u8] { | |
mem::transmute(raw::Slice::<u8> { | |
data: t as *const T as *const u8, | |
len: mem::size_of::<T>(), | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment