machin 0.6.2

Machin is a cli program that simplifies file conversions and batch processing. It's inspired from filter/map/reduce
use std::error::Error;

use crate::machmap::InputTo;
use crate::machreduce::pdf::imagestopdf::ImagesToPdf;

pub struct PngToPdf<'a> {
    pub input_file: &'a str,
    pub output_file: &'a str,
}

impl<'a> PngToPdf<'a> {
    pub fn new(input_file: &'a str, output_file: &'a str) -> PngToPdf<'a> {
        PngToPdf {
            input_file,
            output_file,
        }
    }
}

impl<'a> InputTo<'a> for PngToPdf<'a> {
    fn convert(&self) -> Result<String, Box<dyn Error + 'a>> {
        let img_to_pdf = ImagesToPdf::new();
        img_to_pdf.reduce(vec![&self.input_file.to_string()], self.output_file)
    }
}