Function async_fs::create_dir

source ·
pub async fn create_dir<P: AsRef<Path>>(path: P) -> Result<()>
Expand description

Creates a directory.

Note that this function will only create the final directory in path. If you want to create all of its missing parent directories too, use create_dir_all() instead.

Errors

An error will be returned in the following situations:

  • path already points to an existing file or directory.
  • A parent directory in path does not exist.
  • The current process lacks permissions to create the directory.
  • Some other I/O error occurred.

Examples

async_fs::create_dir("./some/directory").await?;