pub struct CreationConfig {
pub follow_symlinks: bool,
pub include_hidden: bool,
pub max_file_size: Option<u64>,
pub exclude_patterns: Vec<String>,
pub strip_prefix: Option<PathBuf>,
pub compression_level: Option<u8>,
pub preserve_permissions: bool,
pub format: Option<ArchiveType>,
}Expand description
Configuration for archive creation operations.
Controls how archives are created from filesystem sources, including security options, compression settings, and file filtering.
§Examples
use exarch_core::creation::CreationConfig;
// Use secure defaults
let config = CreationConfig::default();
// Customize for specific needs
let custom = CreationConfig::default()
.with_follow_symlinks(true)
.with_compression_level(9);Fields§
§follow_symlinks: boolFollow symlinks when adding files to archive.
Default: false (store symlinks as symlinks).
Security note: Following symlinks may include unintended files from outside the source directory.
Include hidden files (files starting with ‘.’).
Default: false (skip hidden files).
max_file_size: Option<u64>Maximum size for a single file in bytes.
Files larger than this limit will be skipped.
None means no limit.
Default: None.
exclude_patterns: Vec<String>Patterns to exclude from the archive.
Files matching these patterns will be skipped.
Default: [".git", ".DS_Store", "*.tmp"].
strip_prefix: Option<PathBuf>Prefix to strip from entry paths in the archive.
If set, this prefix will be removed from all entry paths. Useful for creating archives without deep directory nesting.
Default: None.
compression_level: Option<u8>Compression level (1-9).
Higher values provide better compression but slower speed.
None uses format-specific defaults.
Default: Some(6) (balanced).
Valid range: 1 (fastest) to 9 (best compression).
preserve_permissions: boolPreserve file permissions in the archive.
Default: true.
format: Option<ArchiveType>Archive format to create.
None means auto-detect from output file extension.
Default: None.
Implementations§
Source§impl CreationConfig
impl CreationConfig
Sourcepub fn with_follow_symlinks(self, follow: bool) -> Self
pub fn with_follow_symlinks(self, follow: bool) -> Self
Sets whether to follow symlinks.
Sets whether to include hidden files.
Sourcepub fn with_max_file_size(self, max_size: Option<u64>) -> Self
pub fn with_max_file_size(self, max_size: Option<u64>) -> Self
Sets the maximum file size.
Sourcepub fn with_exclude_patterns(self, patterns: Vec<String>) -> Self
pub fn with_exclude_patterns(self, patterns: Vec<String>) -> Self
Sets the exclude patterns.
Sourcepub fn with_strip_prefix(self, prefix: Option<PathBuf>) -> Self
pub fn with_strip_prefix(self, prefix: Option<PathBuf>) -> Self
Sets the strip prefix.
Sourcepub fn with_compression_level(self, level: u8) -> Self
pub fn with_compression_level(self, level: u8) -> Self
Sets the compression level.
§Panics
Panics if the compression level is not in the range 1-9.
Use validate() for non-panicking validation.
Sourcepub fn with_preserve_permissions(self, preserve: bool) -> Self
pub fn with_preserve_permissions(self, preserve: bool) -> Self
Sets whether to preserve permissions.
Sourcepub fn with_format(self, format: Option<ArchiveType>) -> Self
pub fn with_format(self, format: Option<ArchiveType>) -> Self
Sets the archive format.
Trait Implementations§
Source§impl Clone for CreationConfig
impl Clone for CreationConfig
Source§fn clone(&self) -> CreationConfig
fn clone(&self) -> CreationConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more