Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. use std::rc::Rc;
  2.  
  3. #[derive(Debug)]
  4. struct Foo {
  5. a: Rc<u32>,
  6. b: Rc<u32>,
  7. }
  8.  
  9. impl Foo {
  10. fn new() -> Self {
  11. let a = Rc::new(123);
  12. Foo { a: a.clone(), b: a.clone() }
  13. }
  14. }
  15.  
  16. fn main() {
  17. let foo = Foo::new();
  18. println!("{}", foo.b);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement