recursive_copy 2.1.0

A minimal, safe, and portable recursive copy library for Unix systems.
Documentation
//! Configuration options for the copy process.
//!
//! This module contains the `CopyOptions` struct, which allows users to
//! customize how files, directories, and symlinks are handled during
//! the recursive copy operation.

/// Configuration settings for the recursive copy operation.
#[derive(Clone, Debug)]
pub struct CopyOptions {
    /// If true, existing files at the destination will be replaced.
    pub overwrite: bool,
    /// If true, copies the actual content of the symlink target instead of
    /// recreating the link at the destination. Loop detection is handled
    /// internally by the walker via `(dev, ino)` tracking.
    pub follow_symlinks: bool,
    /// If true, symlinks whose resolved target falls outside the source tree
    /// are silently skipped. Applies only when `follow_symlinks` is true.
    /// Prevents a symlink like `link -> /etc/passwd` from copying content
    /// outside the intended directory.
    pub restrict_symlinks: bool,
    /// If true, copies only the contents of the source directory, not the
    /// directory itself.
    pub content_only: bool,
    /// The maximum recursion depth for directory traversal.
    pub depth: usize,
    /// If true, directories and files that cannot be accessed due to permission
    /// restrictions (EACCES) are silently skipped instead of aborting the copy.
    pub ignore_permission_denied: bool,
}

impl Default for CopyOptions {
    /// Provides default values for `CopyOptions`.
    fn default() -> Self {
        Self {
            overwrite: false,
            follow_symlinks: false,
            restrict_symlinks: false,
            content_only: false,
            depth: 512,
            ignore_permission_denied: false,
        }
    }
}