Macro serde_yml::macro_create_directories

source ·
macro_rules! macro_create_directories {
    ( $( $_dir:expr ),* ) => { ... };
}
Expand description

§macro_create_directories Macro

Create multiple directories at once.

§Usage

use serde_yml::macro_create_directories;
use std::path::Path;
use tempfile::tempdir;

let temp_dir = tempdir().unwrap();
let path1 = temp_dir.path().join("logs1");
let path2 = temp_dir.path().join("logs2");
 macro_create_directories!(&path1, &path2).unwrap();

§Arguments

  • ... - Variable number of directory paths, each specified as an expression (expr).

§Behaviour

The macro_create_directories macro creates multiple directories at once. It takes a variable number of directory paths as arguments and uses the create_directory utility function from the $crate crate to create the directories.

The directories are specified as expressions and separated by commas.

The macro internally creates a slice of the directory paths and passes it to the create_directory function. If any error occurs during the directory creation, the macro returns an Err value, indicating the first encountered error. Otherwise, it returns Ok(()).