diff options
Diffstat (limited to 'tokio/src/fs/create_dir_all.rs')
-rw-r--r-- | tokio/src/fs/create_dir_all.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tokio/src/fs/create_dir_all.rs b/tokio/src/fs/create_dir_all.rs new file mode 100644 index 00000000..2a7374a3 --- /dev/null +++ b/tokio/src/fs/create_dir_all.rs @@ -0,0 +1,15 @@ +use crate::fs::asyncify; + +use std::io; +use std::path::Path; + +/// Recursively create a directory and all of its parent components if they +/// are missing. +/// +/// This is an async version of [`std::fs::create_dir_all`][std] +/// +/// [std]: https://doc.rust-lang.org/std/fs/fn.create_dir_all.html +pub async fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> { + let path = path.as_ref().to_owned(); + asyncify(move || std::fs::create_dir_all(path)).await +} |