pub fn copy_dir_all_async(src: &Path, dst: &Path) -> Result<(), SsgError>Expand description
Asynchronously copies an entire directory structure, preserving file attributes and handling nested directories.
§Parameters
src: A reference to the source directory path.dst: A reference to the destination directory path.
§Returns
Result<()>:Ok(()): If the directory copying is successful.Err(e): If an error occurs during the directory copying, whereeis the associated error.
§Errors
This function can return the following errors:
std::io::Error: If an error occurs during directory creation, file copying, or permission issues.anyhow::Error: If a file safety check fails.
§Examples
use ssg::fs_ops::copy_dir_all_async;
use tempfile::tempdir;
use std::fs;
let src = tempdir().unwrap();
let dst = tempdir().unwrap();
fs::write(src.path().join("z.txt"), "z").unwrap();
copy_dir_all_async(src.path(), dst.path()).unwrap();
assert!(dst.path().join("z.txt").exists());