pub struct Foo {
some fields ... ;
weak: Weak<Foo>;
}
impl Foo() {
pub fn new() -> Rc<Foo> {
//
}
}
The invariant is that
x: Rc<Foo>; // will always satisfy
Rc::upgrade(x.weak) points to the same object as x
Is this possible? If so, how do we implement the fn new()
above ?