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`][std] 13 /// 14 /// [std]: std::fs::remove_file remove_file(path: impl AsRef<Path>) -> io::Result<()>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 } 19