"oh but you don't actually need that and let me tell you why" - compshit undergrad lecturing 20+ years senior dev.
let foo2 = foo.clone(); let task = ex.spawn(async move { // ... });
That is with child referencing parents. The most common advice is to use a vec allocator, and store the tree using usize indexes. This is terrible because 1) you need to lock your entire allocator whenever modifying the tree and 2) it is just ugly and stupid.
It's not even safe. There is no difference between using usize indexes and actual pointers. It's just simulating pointers.
You have to use unsafe to do this properly.
struct Foo(X); impl Trait for Foo { // ... }
trait Bar { fn my_generic_func(...) { // ... } fn get_foo1() -> Foo1; fn get_foo2() -> Foo1; }Why not just put proper inheritance there?