Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[derive(Debug)]
- struct S(u32);
- fn move_struct() -> S {
- let s = S(0);
- println!("addr before move: {:p}", &s);
- s
- }
- fn move_box() -> Box<S> {
- let s_box = Box::new(S(0));
- println!("addr before box move: {:p}", &*s_box);
- s_box
- }
- fn main() {
- let s = move_struct();
- println!(">addr after move: {:p}", &s);
- let s_box = move_box();
- println!(">addr after box move: {:p}", &*s_box);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement