-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Use ResultWithDefaultError where applicable
- Loading branch information
1 parent
ff44652
commit efcb999
Showing
7 changed files
with
59 additions
and
47 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
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
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,13 +1,13 @@ | ||
use std::path::Path; | ||
use toml; | ||
|
||
use crate::models::ResultWithDefaultError; | ||
|
||
use super::model::TrackConfig; | ||
|
||
pub fn get_config_from_file<P: AsRef<Path>>( | ||
path: P, | ||
) -> Result<TrackConfig, Box<dyn std::error::Error>> { | ||
let contents = std::fs::read_to_string(path)?; | ||
let config: TrackConfig = toml::from_str(&contents)?; | ||
pub fn get_config_from_file<P: AsRef<Path>>(path: P) -> ResultWithDefaultError<TrackConfig> { | ||
let contents = std::fs::read_to_string(path).expect("failed to read config file"); | ||
let config: TrackConfig = toml::from_str(&contents).expect("failed to parse config"); | ||
|
||
Ok(config) | ||
} |
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