use std::rc::Rc; struct S { v1: i32, v2: i32, } fn b(v1: Rc, v2: Rc) -> Rc { println!("Here we go: {} {} {} {}", v1.v1, v1.v2, v2.v1, v2.v2); v1.clone() } fn a (v: Rc) -> Rc { let private_v = Rc::new(S{v1: 1, v2: 3}); println!("I got {} {} and I have {} {} local", v.v1, v.v2, private_v.v1, private_v.v2); b(v.clone(), private_v.clone()) } fn main() { let my_v = Rc::new(S{v1: 2, v2: 4}); let v1 = a(my_v.clone()); println!("{} {} {} {}", my_v.v1, my_v.v2, v1.v1, v1.v2) }