Hello all, I've been "porting" a Project from C++ to- Rust.
Now I have got a Problem with my Scenegraph.
It uses a Trait called ScenegraphElement to store its Elements for Drawing.
This Trait allows to return childs that are also ScenegraphElements.
So far so good. This works, I can have a tree structure of ScenegraphElements in my SG.
My Problem is that, I cannot mutate these underlying objects anymore because these are
of course trait objects, stored in
There is no (obvious) way for me to recover the underlying instance and mutate it.
The perfect solution would be to store them in the renderer (renderer holds scenegraph), as T, and let the SG only hold a Pointer to dyn ScenegraphElement. But I don't know how to do it (if even possible)
How can I structure my Program, so that I can store different Types that implement the ScenegraphElement-Trait, and be able to mutate them?
Thanks in advance