Function serde_yml::utilities::directory::create_directory

source ·
pub fn create_directory(directories: &[&Path]) -> Result<(), Box<dyn Error>>
Expand description

Creates a new directory at the given path.

If the directory already exists, this function does nothing.

§Arguments

  • directories - An array of references to Path objects representing the directories to be created.

§Returns

  • Result<(), Box<dyn Error>> - A result indicating success or failure.
    • Ok(()) if the directories were created successfully.
    • Err(Box<dyn Error>) if an error occurred during the creation process.

§Example

use serde_yml::utilities::directory::create_directory;
use std::path::Path;

let directories = [Path::new("output"), Path::new("temp")];

match create_directory(&directories) {
    Ok(()) => println!("Directories created successfully."),
    Err(e) => eprintln!("Error creating directories: {}", e),
}