pub fn save<P: AsRef<Path>>(
    dims: &ImageDims,
    cspec: &ColorSpec,
    iter: &IterType,
    fname: &P,
) -> Result<(), String> {
    let toml_string = ImageParameters::toml(dims, cspec, iter)?;

    let mut f = match File::create(fname) {
        Ok(f) => f,
        Err(e) => {
            let estr = format!("Error creating output file: {}", &e);
            return Err(estr);
        }
    };

    if let Err(e) = f.write_all(toml_string.as_bytes()) {
        let estr = format!("Error writing to output file: {}", &e);
        return Err(estr);
    }

    if let Err(e) = f.flush() {
        let estr = format!("Error flushing output file: {}", &e);
        return Err(estr);
    }

    Ok(())
}
/// Save the given image information.
Save the given image information.
Save the given image information .
pub fn save<P: AsRef<Path>>(
    dims: &ImageDims,
    cspec: &ColorSpec,
    iter: &IterType,
    fname: &P,
) -> Result<(), String> {
    let toml_string = ImageParameters::toml(dims, cspec, iter)?;
    let mut f = match File::create(fname) {
        Ok(f) => f,
        Err(e) => {
            let estr = format!("Error creating output file: {}", &e);
            return Err(estr);
        }
    };
    if let Err(e) = f.write_all(toml_string.as_bytes()) {
        let estr = format!("Error writing to output file: {}", &e);
        return Err(estr);
    }
    if let Err(e) = f.flush() {
        let estr = format!("Error flushing output file: {}", &e);
        return Err(estr);
    }
    Ok(())
}
pub fn save < P : AsRef < Path > > ( dims : & ImageDims , cspec : & ColorSpec , iter : & IterType , fname : & P , ) -> Result < ( ) , String > { let toml_string = ImageParameters :: toml ( dims , cspec , iter ) ? ; let mut f = match File :: create ( fname ) { Ok ( f ) => f , Err ( e ) => { let estr = format ! ( " " e ) ; return Err ( estr ) ; } } ; if let Err ( e ) = f . write_all ( toml_string . as_bytes ( ) ) { let estr = format ! ( " " e ) ; return Err ( estr ) ; } if let Err ( e ) = f . flush ( ) { let estr = format ! ( " " e ) ; return Err ( estr ) ; } Ok ( ( ) ) }
Save the given image information.
Save the given image information .
dims
&ImageDims
cspec
&ColorSpec
iter
&IterType
fname
&P
dims
&ImageDims
cspec
&ColorSpec
iter
&IterType
fname
&P