summaryrefslogtreecommitdiffstats
path: root/tokio/src/fs/remove_dir_all.rs
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2019-10-21 15:49:00 -0700
committerGitHub <noreply@github.com>2019-10-21 15:49:00 -0700
commit978013a215ebae63cd087139514de32bbd36ce11 (patch)
treedcf43cf2ac044ec9031a79901aa6956351c27ee4 /tokio/src/fs/remove_dir_all.rs
parent6aa6ebb5bce7b2b8c5b81814b6ea47994f0f54d9 (diff)
fs: move into `tokio` (#1672)
A step towards collapsing Tokio sub crates into a single `tokio` crate (#1318). The `fs` implementation is now provided by the main `tokio` crate. The `fs` functionality may still be excluded from the build by skipping the `fs` feature flag.
Diffstat (limited to 'tokio/src/fs/remove_dir_all.rs')
-rw-r--r--tokio/src/fs/remove_dir_all.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tokio/src/fs/remove_dir_all.rs b/tokio/src/fs/remove_dir_all.rs
new file mode 100644
index 00000000..50fe719b
--- /dev/null
+++ b/tokio/src/fs/remove_dir_all.rs
@@ -0,0 +1,14 @@
+use crate::fs::asyncify;
+
+use std::io;
+use std::path::Path;
+
+/// Removes a directory at this path, after removing all its contents. Use carefully!
+///
+/// This is an async version of [`std::fs::remove_dir_all`][std]
+///
+/// [std]: https://doc.rust-lang.org/std/fs/fn.remove_dir_all.html
+pub async fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
+ let path = path.as_ref().to_owned();
+ asyncify(move || std::fs::remove_dir_all(path)).await
+}