SHARE
TWEET

Untitled

a guest Sep 15th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #[derive(Debug)]
  2. struct Testing {
  3.     v: Vec<i32>
  4. }
  5.  
  6. fn sub(a: Box<Testing>) {
  7.     println!("sub: {:?}", a);
  8. }
  9.  
  10. fn main() {
  11.     let y = Testing{v: vec![1,2,3]};
  12.     let x = Box::new(y);
  13.     sub(x);
  14.     // Can't reference x after here.
  15.     println!("main: {:?}", y);
  16. }
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