SHARE
TWEET

Untitled

a guest Jul 19th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #[derive(Debug)]
  2. #[repr(C)]
  3. struct SomeBindgenGeneratedCppClass {
  4.     a: i8,
  5. }
  6.  
  7. pub fn main() {
  8.     let data = [1i8];
  9.     let slice = &data[..];
  10.     let ptr = slice.as_ptr() as *const SomeBindgenGeneratedCppClass;
  11.     let foreign = unsafe { &*ptr };
  12.     println!("{:p}: &{:?}", ptr, foreign);
  13. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top