Function create_folder

Source
pub fn create_folder<P: AsRef<Path>>(path: P)
Expand description

Creates a new folder at the specified path if it does not already exist.

§Arguments

  • path - The path where the folder should be created (can be a &str, String, Path, or PathBuf).

§Panics

If some error is encountered while creating the folder at path.

§Examples

§Using a string literal

use file_io::create_folder;

let path: &str = "folder/subfolder_1";
create_folder(path);

§Using a Path reference

use file_io::create_folder;
use std::path::Path;

let path: &Path = Path::new("folder/subfolder_2");
create_folder(path);