Hi,
I have this code
Which is this
struct A<'a> {
data: u32,
all: Vec<&'a A<'a>>
}
impl<'a> A<'a> {
fn new() -> A<'a> {
A { data: 0, all: Vec::new() }
}
}
fn main() {
let mut a = A::new();
let mut b = A::new();
//a.all.push(&b);
b.all.push(&a);
println!(" {}", b.all[0].data);
a.data = 2;
println!(" {}", b.all[0].data);
}
I need a, b mutable maybe I have to use Rc or Weak.
Thanks.