Debian Codegraph @

third_party/rust/tokio/src/fs/remove_file.rs

raw
1 use crate::fs::asyncify;
2
3 use std::io;
4 use std::path::Path;
5
6 /// Removes a file from the filesystem.
7 ///
8 /// Note that there is no guarantee that the file is immediately deleted (e.g.
9 /// depending on platform, other open file descriptors may prevent immediate
10 /// removal).
11 ///
12 /// This is an async version of [`std::fs::remove_file`].
13 pub async fn remove_file(path: impl AsRef<Path>) -> io::Result<()> {
14 let path = path.as_ref().to_owned();
15 asyncify(move || std::fs::remove_file(path)).await
16 }