diff options
| author | pml68 <contact@pml68.dev> | 2025-03-01 02:29:03 +0100 |
|---|---|---|
| committer | pml68 <contact@pml68.dev> | 2025-03-01 02:29:03 +0100 |
| commit | 13ec2282c914c076ff50ddc44bee1feeb7983ae8 (patch) | |
| tree | 4623cd5c3c917004c0b45c0912f10773fa838b51 /src/types/project.rs | |
| parent | ci: add step for running tests (diff) | |
| download | iced-builder-13ec2282c914c076ff50ddc44bee1feeb7983ae8.tar.gz | |
refactor: make config an `Arc<Config>` in `App`
Diffstat (limited to 'src/types/project.rs')
| -rw-r--r-- | src/types/project.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/types/project.rs b/src/types/project.rs index e665d5e..721783e 100644 --- a/src/types/project.rs +++ b/src/types/project.rs @@ -1,4 +1,5 @@ use std::path::{Path, PathBuf}; +use std::sync::Arc; extern crate fxhash; use fxhash::FxHashMap; @@ -58,7 +59,7 @@ impl Project { pub async fn from_path( path: PathBuf, - config: Config, + config: Arc<Config>, ) -> Result<(PathBuf, Self), Error> { let contents = tokio::fs::read_to_string(&path).await?; let mut project: Self = serde_json::from_str(&contents)?; @@ -68,7 +69,9 @@ impl Project { Ok((path, project)) } - pub async fn from_file(config: Config) -> Result<(PathBuf, Self), Error> { + pub async fn from_file( + config: Arc<Config>, + ) -> Result<(PathBuf, Self), Error> { let picked_file = rfd::AsyncFileDialog::new() .set_title("Open a JSON file...") .add_filter("*.json, *.JSON", &["json", "JSON"]) |
