broker_tokio/fs/remove_file.rs
1use crate::fs::asyncify;
2
3use std::io;
4use 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`][std]
13///
14/// [std]: std::fs::remove_file
15pub async fn remove_file(path: impl AsRef<Path>) -> io::Result<()> {
16 let path = path.as_ref().to_owned();
17 asyncify(move || std::fs::remove_file(path)).await
18}