From 13ec2282c914c076ff50ddc44bee1feeb7983ae8 Mon Sep 17 00:00:00 2001 From: pml68 Date: Sat, 1 Mar 2025 02:29:03 +0100 Subject: refactor: make config an `Arc` in `App` --- src/types/project.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/types/project.rs') 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, ) -> 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, + ) -> Result<(PathBuf, Self), Error> { let picked_file = rfd::AsyncFileDialog::new() .set_title("Open a JSON file...") .add_filter("*.json, *.JSON", &["json", "JSON"]) -- cgit v1.2.3