Remove Ref<Cell<>> for all controllers except MainController.
Move shared states (such as boundaries: Rc<RefCell<ChaptersBoundaries>> or current_position: u64,) into a struct which is accessible from MainController.
Only pass the Ref<Cell<MainController>> to callbacks.
Callbacks would be able to interact with any controller logic and state using only one Ref<Cell<>>. And shared states would no longer need to be Ref<Cell<>> or copied & synchronized.
See https://kyren.github.io/2018/09/14/rustconf-talk.html as an inspiration.
This is what I plan on exploring:
Ref<Cell<>>
for all controllers exceptMainController
.boundaries: Rc<RefCell<ChaptersBoundaries>>
orcurrent_position: u64,
) into astruct
which is accessible fromMainController
.Ref<Cell<MainController>>
to callbacks.Callbacks would be able to interact with any controller logic and state using only one
Ref<Cell<>>
. And shared states would no longer need to beRef<Cell<>>
or copied & synchronized.