summaryrefslogtreecommitdiff
path: root/src/templatespec.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-05-05 19:28:57 +0300
committerLars Wirzenius <liw@liw.fi>2022-05-05 19:28:57 +0300
commit6498b2eecb21ad87069be8f501f35374745106d9 (patch)
tree18af0fcdb186609452825adb3155badcd4aaa013 /src/templatespec.rs
parent12059fcb1ce8237e5587773043cd442e036531c2 (diff)
downloadsubplot-6498b2eecb21ad87069be8f501f35374745106d9.tar.gz
refactor: drop the subplot::Result type alias
Replace subplot::Result<T> with Result<T, SubplotError>. I find this now to be clearer, as I don't need to remind myself which Result is being used where. This should not be a breaking change. Sponsored-by: author
Diffstat (limited to 'src/templatespec.rs')
-rw-r--r--src/templatespec.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/templatespec.rs b/src/templatespec.rs
index 5d7150b..dbb39dc 100644
--- a/src/templatespec.rs
+++ b/src/templatespec.rs
@@ -1,5 +1,4 @@
use crate::resource;
-use crate::Result;
use crate::SubplotError;
use serde::Deserialize;
@@ -21,7 +20,7 @@ pub struct TemplateSpec {
impl TemplateSpec {
// Create a new TemplateSpec from YAML text.
- fn from_yaml(yaml: &str) -> Result<TemplateSpec> {
+ fn from_yaml(yaml: &str) -> Result<TemplateSpec, SubplotError> {
Ok(serde_yaml::from_str(yaml)?)
}
@@ -40,7 +39,7 @@ impl TemplateSpec {
}
/// Read a template.yaml file and create the corresponding TemplateSpec.
- pub fn from_file(filename: &Path) -> Result<TemplateSpec> {
+ pub fn from_file(filename: &Path) -> Result<TemplateSpec, SubplotError> {
let yaml = resource::read_as_string(filename, None)?;
let spec = TemplateSpec::from_yaml(&yaml)?;
let dirname = match filename.parent() {