Skip to content

App Organisation #1364

Answered by tarkah
tsoutsman asked this question in Q&A
Discussion options

You must be logged in to vote

This structure is just fine! If you remove &mut App from the view / update functions of each module, you'll no longer run into the issue. Those modules don't need to depend on App and shouldn't be aware of it anyways (circular dependency). Is there a reason you were trying to pass App down into those modules?

If you're wanting to update App within each, you'd be better off having update from each module return an Option<Event> that you can use in the parent module to update it's state. You can also define Message for each module and map that into the parent Message, see below.

// in app::uninitialised

// uninitialized related messages
pub enum Message {
    ..
}

// events that need to b…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hecrj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants