fn write_contents_to_file<C: AsRef<[u8]>>(
        gendir: impl AsRef<Path>,
        file_path: impl AsRef<Path>,
        contents: C,
    ) -> Result<PathBuf> {
        let file_path = gendir.as_ref().join(file_path);
        if let Some(parent_dir) = file_path.parent() {
            std::fs::create_dir_all(parent_dir)
                .context(format!("creating parent directories for {}", file_path.display()))?;
        }
        std::fs::write(&file_path, contents)
            .context(format!("writing contents to file: {}", file_path.display()))?;
        Ok(file_path)
    }
/// Helper fn to write the contents to a file, creating the parent dirs as needed when doing so.
Helper fn to write the contents to a file, creating the parent dirs as needed when doing so.
Helper fn to write the contents to a file creating the parent dirs as needed when doing so .
fn write_contents_to_file<C: AsRef<[u8]>>(
        gendir: impl AsRef<Path>,
        file_path: impl AsRef<Path>,
        contents: C,
    ) -> Result<PathBuf> {
        let file_path = gendir.as_ref().join(file_path);
        if let Some(parent_dir) = file_path.parent() {
            std::fs::create_dir_all(parent_dir)
                .context(format!("creating parent directories for {}", file_path.display()))?;
        }
        std::fs::write(&file_path, contents)
            .context(format!("writing contents to file: {}", file_path.display()))?;
        Ok(file_path)
    }
fn write_contents_to_file < C : AsRef < [ u8 ] > > ( gendir : impl AsRef < Path > , file_path : impl AsRef < Path > , contents : C , ) -> Result < PathBuf > { let file_path = gendir . as_ref ( ) . join ( file_path ) ; if let Some ( parent_dir ) = file_path . parent ( ) { std :: fs :: create_dir_all ( parent_dir ) . context ( format ! ( " " file_path display ( ) ) ) ? ; } std :: fs :: write ( & file_path , contents ) . context ( format ! ( " " file_path display ( ) ) ) ? ; Ok ( file_path ) }
Helper fn to write the contents to a file, creating the parent dirs as needed when doing so.
Helper fn to write the contents to a file creating the parent dirs as needed when doing so .
gendir
impl AsRef<Path>
file_path
impl AsRef<Path>
contents
C
gendir
impl AsRef<Path>
file_path
impl AsRef<Path>
contents
C