Function fsio::file::delete [−][src]
pub fn delete<T: AsPath + ?Sized>(path: &T) -> FsIOResult<()>
Expand description
Deletes the requested file. If the file does not exist, this function will return valid response.
Arguments
path
- The file path
Example
use crate::fsio::file; use std::path::Path; use std::str; fn main() { let file_path = "./target/__test/file_test/delete_file/file.txt"; let mut result = file::ensure_exists(file_path); assert!(result.is_ok()); let path = Path::new(file_path); assert!(path.exists()); result = file::delete(file_path); assert!(result.is_ok()); assert!(!path.exists()); }