}
}
pub use crate::display_as_debug;
+
+#[macro_export]
+macro_rules! error_from_losedetails {
+ {$to:ty, $variant:ident, $from:ty} => {
+ impl From<$from> for $to {
+ fn from(_: $from) -> Self { <$to>::$variant }
+ }
+ }
+}
+pub use crate::error_from_losedetails;
WriteFail,
}
display_as_debug!{SVGProcessError}
-impl From<fmt::Error> for SVGProcessError {
- fn from(_: fmt::Error) -> Self { SVGProcessError::WriteFail }
-}
+error_from_losedetails!{SVGProcessError, WriteFail, fmt::Error}
#[throws(SVGProcessError)]
pub fn svg_rescale_path(input: &str, scale: f64) -> String {