Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::rc::Rc;
- #[derive(Debug)]
- struct Foo {
- a: Rc<u32>,
- b: Rc<u32>,
- }
- impl Foo {
- fn new() -> Self {
- let a = Rc::new(123);
- Foo { a: a.clone(), b: a.clone() }
- }
- }
- fn main() {
- let foo = Foo::new();
- println!("{}", foo.b);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement