← Back to context

Comment by Charon77

3 months ago

A owns B, and B can find A

I think you should think less like Java/C# and more like database.

If you have a Comment object that has parent object, you need to store the parent as a 'reference', because you can't put the entire parent.

So I'll probably use Box here to refer to the parent

?? the whole point of Box<T> is to be an owning reference, you can’t have multiple children refer to the same parent object if you use a Box

If you use Box to refer to parent, then parent cannot own the child (unless using things like Arc<Mutex<>>).