Component application pattern: how to compose components

New to both Rust and Ratatui. Writing a frontend to control a few tokio actors with complex state machines inside, put my heart on the component application pattern, based on the component template.

I wonder: how can I compose components together, i.e. use components A and B inside component C ? All three would be implementing the Component trait, of course. Can I just pass down all the methods of Component to the children, e.g.

  • call the register_action_handler(..) of A and B from register_action_handler(..)in A,
  • call update(..) for A and B from update(..) in C
  • call draw(..) for A and B from draw(..) in C
  • and so on ?

Or is there a better approach, or is that not part of this pattern at all (I couldn’t find any examples)? I don’t feel that exposing domain methods of a component (i.e. the increment_counter(…) of the examples and calling them from the parent is a good approach, everything should be controlled by dispatching Actions, IMHO.

Many thanks for your opinions in advance

maybe rat-salsa/rat-salsa/examples/async1.rs at master · thscharler/rat-salsa · GitHub