summaryrefslogtreecommitdiff
path: root/src/diagrams.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/diagrams.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/diagrams.rs')
-rw-r--r--src/diagrams.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/diagrams.rs b/src/diagrams.rs
index 96f5d70..264bd3f 100644
--- a/src/diagrams.rs
+++ b/src/diagrams.rs
@@ -1,4 +1,4 @@
-use crate::{Result, SubplotError};
+use crate::SubplotError;
use std::env;
use std::ffi::OsString;
@@ -72,7 +72,7 @@ lazy_static! {
/// for the trait.
pub trait DiagramMarkup {
/// Convert the markup into an SVG.
- fn as_svg(&self) -> Result<Vec<u8>>;
+ fn as_svg(&self) -> Result<Vec<u8>, SubplotError>;
}
/// A code block with pikchr markup.
@@ -99,7 +99,7 @@ impl PikchrMarkup {
}
impl DiagramMarkup for PikchrMarkup {
- fn as_svg(&self) -> Result<Vec<u8>> {
+ fn as_svg(&self) -> Result<Vec<u8>, SubplotError> {
let mut flags = pikchr::PikchrFlags::default();
flags.generate_plain_errors();
let image = pikchr::Pikchr::render(&self.markup, self.class.as_deref(), flags)
@@ -130,7 +130,7 @@ impl DotMarkup {
}
impl DiagramMarkup for DotMarkup {
- fn as_svg(&self) -> Result<Vec<u8>> {
+ fn as_svg(&self) -> Result<Vec<u8>, SubplotError> {
let mut child = Command::new(DOT_PATH.lock().unwrap().clone())
.arg("-Tsvg")
.stdin(Stdio::piped())
@@ -191,7 +191,7 @@ impl PlantumlMarkup {
}
impl DiagramMarkup for PlantumlMarkup {
- fn as_svg(&self) -> Result<Vec<u8>> {
+ fn as_svg(&self) -> Result<Vec<u8>, SubplotError> {
let mut cmd = Command::new(JAVA_PATH.lock().unwrap().clone());
cmd.arg("-Djava.awt.headless=true")
.arg("-jar")