CreationConfig

Struct CreationConfig 

Source
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: bool

Follow 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: bool

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: bool

Preserve 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

Source

pub fn new() -> Self

Creates a new CreationConfig with default settings.

Sets whether to follow symlinks.

Source

pub fn with_include_hidden(self, include: bool) -> Self

Sets whether to include hidden files.

Source

pub fn with_max_file_size(self, max_size: Option<u64>) -> Self

Sets the maximum file size.

Source

pub fn with_exclude_patterns(self, patterns: Vec<String>) -> Self

Sets the exclude patterns.

Source

pub fn with_strip_prefix(self, prefix: Option<PathBuf>) -> Self

Sets the strip prefix.

Source

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.

Source

pub fn with_preserve_permissions(self, preserve: bool) -> Self

Sets whether to preserve permissions.

Source

pub fn with_format(self, format: Option<ArchiveType>) -> Self

Sets the archive format.

Source

pub fn validate(&self) -> Result<()>

Validates the configuration.

§Errors

Returns an error if:

  • Compression level is set but not in range 1-9

Trait Implementations§

Source§

impl Clone for CreationConfig

Source§

fn clone(&self) -> CreationConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CreationConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CreationConfig

Source§

fn default() -> Self

Creates a CreationConfig with secure default settings.

Default values:

  • follow_symlinks: false
  • include_hidden: false
  • max_file_size: None
  • exclude_patterns: [".git", ".DS_Store", "*.tmp"]
  • strip_prefix: None
  • compression_level: Some(6)
  • preserve_permissions: true
  • format: None

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.