I’m creating a workspace model for a desktop application.
The workspace will have a file tree, open documents with mutable data, live queries over the documents and file tree, etc. At this point I’ve used rust to build the file tree component. Now I want to start building up the other parts, and I need to decide how everything communicates. For example live queries need to know about changes in the file tree and document state. Views need to know about changes to live queries. Other views need to know about changes to document models, etc.
Previous to rust I would solve this problem by having each model maintain and notify a list of observers. Or maybe use a single notification center (such as NSNotificationCenter) to manager the subscriptions and send the events. But in rust these implementations seem a little messy to implement… dealing with questions of ownership and mutability. And generally no one seems to use or updates the crates that I’ve found that implement this pattern. Anyway, I’m looking for suggestions on best way to solve the problem in rust.
With that in mind I’ve been reading about Actix (not the web part, just the actor model) and from a distance it’s appealing. It seems to make all this communication more structured, decoupled, and it’s popular. At the same time it’s a big system to buy into, maybe it’s overkill for what I’m trying to do.
So my questions:
Would you consider Actix an appropriate solution for managing communication between objects in the workspace model of a desktop application?
If not can you suggest an alternative approach that’s better than a default implementation of the observer pattern?