Open
Description
What problem does this solve or what need does it fill?
As mentioned in #19045 and #16840 it would be nice to have a way to specify relationships in required components
What solution would you like?
Perhaps something like this?
#[derive(Component)]
#[require(
Related::<Children>((
Text::new("Some interesting..."),
(
Text::new("writing here."),
TextColor(css::PURPLE)
)
))
// Not sure if this should override or add to the parent if it already exists, leaning to add, but depends on feasibility and what other people want
Related::<ChildOf>(
Node
)
Related::<Observer>((
// This gets more tricky because observers are m-m, not sure how to do this without duplicating a lot of observers that do the exact same thing.
))
)]
pub struct TextContainer;
What alternative(s) have you considered?
Use the old method, but that doesn't hold up relationship invariants.