Skip to content

Architecture

nick42d edited this page Dec 3, 2023 · 9 revisions

Youtui & ytmapi-rs Architecture

Design constraints

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.

  1. Avoid shared mutable state: The app will avoid shared mutable state primitives such as Mutex and RefCell and instead communicate via messaging.
  2. 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.
  3. Avoid cloning: Where possible, the app will avoid cloning as a method to beat the borrow checker. Instead, we will try to safely borrow.
  4. Encode state into the type system: Where possible use the type system to represent actions that are not possible in the current state.

Youtui Architecture Diagram

WIP

graph TD;
M[youtui::main]
Config
M-->Config-->CLI
Config-->TUI
CLI-->Error
TUI-->Error
Error
CLI
subgraph TUI
subgraph App
EventHandler-->TaskManager-->Server
EventHandler-->UI
TaskManager-->UI-->View
UI-->CallbackQueue-->TaskManager
CallbackQueue-->UI
end
end
Loading
Clone this wiki locally