Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement