Macro serde_yml::macro_cleanup_directories

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

§macro_cleanup_directories Macro

Cleanup multiple directories by invoking the cleanup_directory function.

§Usage

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

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

§Arguments

  • $( $_dir:expr ),* - A comma-separated list of directory paths to clean up.

§Behaviour

The macro_cleanup_directories macro takes multiple directory paths as arguments and invokes the cleanup_directory function for each path. It is assumed that the cleanup_directory function is available in the crate’s utilities module ($crate::utilities::cleanup_directory).

The macro creates an array directories containing the provided directory paths and passes it as an argument to cleanup_directory. The cleanup_directory function is responsible for performing the cleanup operations.

Please note that the macro uses the ? operator for error propagation. It expects the cleanup_directory function to return a Result type. If an error occurs during the cleanup process, it will be propagated up the call stack, allowing the caller to handle it appropriately.