-
Notifications
You must be signed in to change notification settings - Fork 4
Architecture
nick42d edited this page Aug 20, 2024
·
9 revisions
App has been designed for me to learn Rust, and therefore I have implemented the following constraints to learn some features. I am aware these may not be the most efficient ways to code.
- Avoid shared mutable state: The app will avoid shared mutable state primitives such as Mutex and RefCell and instead communicate via messaging.
- Concurrency over parralelism: Where possible, the app will use use an asynchronous mode of operation (such as futures::join! and tokio::select) over parallel equivalents such as tokio::spawn and thread::spawn.
- Avoid cloning: Where possible, the app will avoid cloning as a method to beat the borrow checker. Instead, we will try to safely borrow.
- Encode state into the type system: Where possible use the type system to represent actions that are not possible in the current state.
- Avoid dynamic dispatch: Where possible, static dispatch will be used over dynamic dispatch
WIP
flowchart TD
M("youtui::main()")-->Clap-->Config-->CLI
Config-->TUI
CLI-->Error
TUI-->Error
Error
CLI
subgraph TUI
subgraph App
subgraph "App.run()"
direction TB
H("handle_next_event()")==>C("process_callbacks()")
C-.->TaskManager
C==>S("synchronize_state()")==>D("draw")
D==>H
end
EventHandler
TaskManager
EventHandler
UI
CallbackQueue
EventHandler-.->H
H-.->UI
CallbackQueue-.->C
C-.->UI
TaskManager<-.->Server
TaskManager-.->S
S-.->UI
UI-.->D
end
Server
end
- Module documentation
- Traits
- Structs
- Major struct implementations
- Implementations (Grouped by trait)
- Functions