Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[derive(Debug)]
- struct Testing {
- v: Vec<i32>
- }
- fn sub(a: Box<Testing>) {
- println!("sub: {:?}", a);
- }
- fn main() {
- let y = Testing{v: vec![1,2,3]};
- let x = Box::new(y);
- sub(x);
- // Can't reference x after here.
- println!("main: {:?}", y);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement