summaryrefslogtreecommitdiff
path: root/src/metadata.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/metadata.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/metadata.rs')
-rw-r--r--src/metadata.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/metadata.rs b/src/metadata.rs
index 0248891..5f5e183 100644
--- a/src/metadata.rs
+++ b/src/metadata.rs
@@ -1,5 +1,4 @@
-use crate::Result;
-use crate::{Bindings, TemplateSpec};
+use crate::{Bindings, SubplotError, TemplateSpec};
use std::collections::HashMap;
use std::fmt::Debug;
@@ -31,7 +30,11 @@ pub struct DocumentImpl {
impl Metadata {
/// Construct a Metadata from a Document, if possible.
- pub fn new<P>(basedir: P, doc: &Pandoc, template: Option<&str>) -> Result<Metadata>
+ pub fn new<P>(
+ basedir: P,
+ doc: &Pandoc,
+ template: Option<&str>,
+ ) -> Result<Metadata, SubplotError>
where
P: AsRef<Path> + Debug,
{
@@ -152,7 +155,7 @@ fn get_bindings_filenames(map: &Mapp) -> Vec<PathBuf> {
get_paths("", map, "bindings")
}
-fn load_template_spec(template: &str) -> Result<TemplateSpec> {
+fn load_template_spec(template: &str) -> Result<TemplateSpec, SubplotError> {
let mut spec_path = PathBuf::from(template);
spec_path.push("template");
spec_path.push("template.yaml");
@@ -298,7 +301,11 @@ mod test_join {
}
}
-fn get_bindings<P>(filenames: &[P], bindings: &mut Bindings, template: Option<&str>) -> Result<()>
+fn get_bindings<P>(
+ filenames: &[P],
+ bindings: &mut Bindings,
+ template: Option<&str>,
+) -> Result<(), SubplotError>
where
P: AsRef<Path> + Debug,
{