I have a parent struct that creates child structs which independently receive events. These children need to inform the parent of these events so the parent can mutate itself and potential modify the list of children.
I can't quite figure out the right way of structuring this, specifically the notification from child to parent.
I've tried a simple callback method being passed from parent to child but this seems to end up in a bit of a lifecycle hell and from my research doesn't seem idiomatic at all.
I've also thought of implementing a trait on parent and pass this to the children. I've had trouble getting this to compile also and again, doesn't seem to be idiomatic.
I'm looking for some inspiration/advice for this kind of pattern. Should this even be a thing? Is it better to try and keep all handling in the parent itself and remove the children (difficult to answer without more details).