I have found a number of solutions or workarounds for this common use case, but most seem to be either quite old, or overly complex. I was wondering if there had been any movement in this area and what the current best practices for idiomatic Rust would be.
Basically I have a struct of type X that has a vector of struct 'Y'. In struct 'Y' I have some local configuration information, but should that information be missing, I'd want to use the configuration of the parent struct 'X'.
What is the current best practice for this sort of relationship?
I'd avoid the Rc<_> approach. For one, you can easily introduce reference cycles if you aren't careful, and letting the child has some sort of reference back to its parent muddies the ownership story (as evidenced by the need to use RefCell for mutation).
Instead, make the "I might need a default value" requirement explicit when trying to access the child's value.