Function serde_yml::utilities::directory::cleanup_directory
source · pub fn cleanup_directory(directories: &[&Path]) -> Result<(), Box<dyn Error>>
Expand description
Cleans up the directory at the given path.
If the directory does not exist, this function does nothing.
§Arguments
directories
- An array of references toPath
objects representing the directories to be cleaned up.
§Returns
Result<(), Box<dyn Error>>
- A result indicating success or failure.Ok(())
if the directories were cleaned up successfully.Err(Box<dyn Error>)
if an error occurred during the cleanup process.
§Example
use serde_yml::utilities::directory::cleanup_directory;
use std::path::Path;
let directories = [Path::new("output"), Path::new("temp")];
match cleanup_directory(&directories) {
Ok(()) => println!("Directories cleaned up successfully."),
Err(e) => eprintln!("Error cleaning up directories: {}", e),
}