-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): implement config system (#34)
* feat(config): implement config system Resolved: #25 * chore(changeset): add changeset * feat(config): add config proxy object * feat(config): extend `String` to handle default errors * chore(changeset): add changeset
- Loading branch information
Showing
18 changed files
with
234 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@noctisynth/grassator': patch | ||
--- | ||
|
||
Extend `String` to `ErrorPayload` to handle default errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@noctisynth/grassator': patch | ||
--- | ||
|
||
Fix set config arg name to `newConfig` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'grassator': patch | ||
'@noctisynth/grassator': patch | ||
--- | ||
|
||
Implement config system and auto load on startup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@noctisynth/grassator': patch | ||
--- | ||
|
||
Add global config proxy object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'grassator': patch | ||
'@noctisynth/grassator': patch | ||
--- | ||
|
||
Add config file path to callback data structure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,29 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use tauri::async_runtime::RwLock; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub(crate) struct InnerConfig { | ||
pub(crate) preset_file: Option<String>, | ||
pub(crate) num_threads: Option<u32>, | ||
} | ||
|
||
impl Default for InnerConfig { | ||
fn default() -> Self { | ||
Self { | ||
preset_file: None, | ||
num_threads: Some(12), | ||
} | ||
} | ||
} | ||
|
||
pub(crate) struct Config { | ||
pub(crate) preset_file: String, | ||
pub(crate) num_threads: u32, | ||
pub(crate) inner: RwLock<InnerConfig>, | ||
} | ||
|
||
impl Default for Config { | ||
fn default() -> Self { | ||
Self { | ||
preset_file: String::from("presets/default.json"), | ||
num_threads: 7, | ||
inner: RwLock::new(InnerConfig::default()), | ||
} | ||
} | ||
} |
Oops, something went wrong.