pub fn create_dirs_and_write<P: AsRef<Path>, C: AsRef<[u8]>>(
    path: P,
    contents: C,
) -> io::Result<()> {
    // no parent means no directory component, and we can directly write to that
    // file
    path.as_ref().parent().map_or(Ok(()), create_dir_all)?;

    write(path.as_ref(), contents)
}
/// A simple api for creating all the directories up to a path for a file, and
/// then writing the contents to that file.
A simple api for creating all the directories up to a path for a file, and
then writing the contents to that file.
A simple api for creating all the directories up to a path for a file and then writing the contents to that file .
pub fn create_dirs_and_write<P: AsRef<Path>, C: AsRef<[u8]>>(
    path: P,
    contents: C,
) -> io::Result<()> {
    // no parent means no directory component, and we can directly write to that
    // file
    path.as_ref().parent().map_or(Ok(()), create_dir_all)?;
    write(path.as_ref(), contents)
}
pub fn create_dirs_and_write < P : AsRef < Path > , C : AsRef < [ u8 ] > > ( path : P , contents : C , ) -> io :: Result < ( ) > { // no parent means no directory component, and we can directly write to that // file path . as_ref ( ) . parent ( ) . map_or ( Ok ( ( ) ) , create_dir_all ) ? ; write ( path . as_ref ( ) , contents ) }
A simple api for creating all the directories up to a path for a file, and
then writing the contents to that file.
A simple api for creating all the directories up to a path for a file and then writing the contents to that file .
path
P
contents
C
path
P
contents
C