Add support for custom global state (#111)

* feat: add 'has_main_file' to App struct

* feat: handle custom state from the main.rs file

* feat: update tutorial template with new setup

* fix: apply clippy hints

* feat: add ApplicationState mention to documentation website

* feat: update version to v0.13.0
This commit is contained in:
Valerio Ageno
2024-11-17 16:28:56 +01:00
committed by GitHub
parent 253e0a8378
commit df92ef5296
17 changed files with 242 additions and 33 deletions
+1
View File
@@ -10,4 +10,5 @@ path = ".tuono/main.rs"
[dependencies]
tuono_lib = { path = "../../crates/tuono_lib/"}
serde = { version = "1.0.202", features = ["derive"] }
reqwest = "0.12.9"
+11
View File
@@ -0,0 +1,11 @@
use reqwest::Client;
#[derive(Clone)]
pub struct ApplicationState {
pub fetch: Client,
}
pub fn main() -> ApplicationState {
let fetch = Client::new();
return ApplicationState { fetch };
}