fix: remove useless threading
This commit is contained in:
parent
6cd0af304f
commit
6981fe8f16
9 changed files with 157 additions and 38 deletions
27
pkgr/src/config/mod.rs
Normal file
27
pkgr/src/config/mod.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Config {
|
||||
#[serde(default)]
|
||||
pub build_by_default: bool,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn from_path(path: &str) -> Result<Config, String> {
|
||||
match std::fs::read_to_string(path) {
|
||||
Ok(s) => match toml::from_str(&s) {
|
||||
Ok(c) => Ok(c),
|
||||
Err(e) => Err(format!("failed to parse config: {}", e)),
|
||||
},
|
||||
Err(e) => Err(format!("failed to read config: {}", e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Config {
|
||||
Config {
|
||||
build_by_default: false,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue