CreationReport

Struct CreationReport 

Source
pub struct CreationReport {
    pub files_added: usize,
    pub directories_added: usize,
    pub symlinks_added: usize,
    pub bytes_written: u64,
    pub bytes_compressed: u64,
    pub duration: Duration,
    pub files_skipped: usize,
    pub warnings: Vec<String>,
}
Expand description

Report of an archive creation operation.

Contains statistics and metadata about the creation process.

§Examples

use exarch_core::creation::CreationReport;

let mut report = CreationReport::default();
report.files_added = 10;
report.bytes_written = 1024;
report.bytes_compressed = 512;

assert_eq!(report.compression_ratio(), 2.0);
assert_eq!(report.compression_percentage(), 50.0);

Fields§

§files_added: usize

Number of files added to the archive.

§directories_added: usize

Number of directories added to the archive.

§symlinks_added: usize

Number of symlinks added to the archive.

§bytes_written: u64

Total bytes written to the archive (uncompressed).

§bytes_compressed: u64

Total bytes in the final archive (compressed).

§duration: Duration

Duration of the creation operation.

§files_skipped: usize

Number of files skipped (due to filters or errors).

§warnings: Vec<String>

Warnings generated during creation.

Implementations§

Source§

impl CreationReport

Source

pub fn new() -> Self

Creates a new empty creation report.

Source

pub fn add_warning(&mut self, msg: impl Into<String>)

Adds a warning message to the report.

§Examples
use exarch_core::creation::CreationReport;

let mut report = CreationReport::new();
report.add_warning("File too large, skipped");
assert!(report.has_warnings());
Source

pub fn has_warnings(&self) -> bool

Returns whether any warnings were generated.

§Examples
use exarch_core::creation::CreationReport;

let mut report = CreationReport::new();
assert!(!report.has_warnings());

report.add_warning("test warning");
assert!(report.has_warnings());
Source

pub fn compression_ratio(&self) -> f64

Returns the compression ratio (uncompressed / compressed).

Returns 0.0 if bytes_compressed is 0 or bytes_written is 0.

§Examples
use exarch_core::creation::CreationReport;

let mut report = CreationReport::new();
report.bytes_written = 1000;
report.bytes_compressed = 500;
assert_eq!(report.compression_ratio(), 2.0);

// Edge case: zero compressed size
report.bytes_compressed = 0;
assert_eq!(report.compression_ratio(), 0.0);

// Edge case: equal sizes (no compression)
report.bytes_written = 1000;
report.bytes_compressed = 1000;
assert_eq!(report.compression_ratio(), 1.0);
Source

pub fn compression_percentage(&self) -> f64

Returns the compression percentage (space saved).

Returns 0.0 if bytes_written is 0. Returns 100.0 if bytes_compressed is 0 (perfect compression).

§Examples
use exarch_core::creation::CreationReport;

let mut report = CreationReport::new();
report.bytes_written = 1000;
report.bytes_compressed = 500;
assert_eq!(report.compression_percentage(), 50.0);

// Edge case: no compression
report.bytes_compressed = 1000;
assert_eq!(report.compression_percentage(), 0.0);

// Edge case: perfect compression
report.bytes_compressed = 0;
assert_eq!(report.compression_percentage(), 100.0);
Source

pub fn total_items(&self) -> usize

Returns total number of items added.

§Examples
use exarch_core::creation::CreationReport;

let mut report = CreationReport::new();
report.files_added = 10;
report.directories_added = 5;
report.symlinks_added = 2;
assert_eq!(report.total_items(), 17);

Trait Implementations§

Source§

impl Clone for CreationReport

Source§

fn clone(&self) -> CreationReport

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 CreationReport

Source§

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

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

impl Default for CreationReport

Source§

fn default() -> CreationReport

Returns the “default value” for a type. Read more

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.