[][src]Function async_std::fs::create_dir

pub async fn create_dir<P: AsRef<Path>>(path: P) -> Result<()>

Creates a new 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 the create_dir_all function instead.

This function is an async version of std::fs::create_dir.

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

use async_std::fs;

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