diff --git a/src/convert.rs b/src/convert.rs index 93019b1..1000370 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -4,7 +4,12 @@ use std::path::Path; use image::ImageReader; use markdown; -pub fn to_webp(path: &Path) -> Result<(), Box> { +pub fn to_webp

(path: P) -> Result<(), Box> +where + P: AsRef, +{ + let path = path.as_ref(); + ImageReader::open(path)?.decode()?.save(format!( "{}.webp", path.file_stem().unwrap().to_str().unwrap() @@ -13,7 +18,10 @@ pub fn to_webp(path: &Path) -> Result<(), Box> { Ok(()) } -pub fn md_to_html(path: &Path) -> Result { +pub fn md_to_html

(path: P) -> Result +where + P: AsRef, +{ let mut buf = String::new(); // Loading and Converting post.md to html