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 fromregister_action_handler(..)in A, - call
update(..)for A and B fromupdate(..)in C - call
draw(..)for A and B fromdraw(..)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