Zip

Trait Zip 

Source
pub trait Zip {
    // Required methods
    fn calculate_size<P>(&self, path: P) -> Result<f64, BridgeError>
       where P: AsRef<Path>;
    fn get_size<P>(&self, path: P) -> u64
       where P: AsRef<Path>;
    fn extract<P>(
        &self,
        zip_src_path: P,
        zip_output_path: P,
    ) -> Result<bool, BridgeError>
       where P: AsRef<Path>;
    fn file_compression<P>(
        &self,
        zip_input_path: P,
        zip_output_path: P,
    ) -> Result<bool, BridgeError>
       where P: AsRef<Path>;
    fn single_folder_compression<P>(
        &self,
        zip_input_path: P,
        zip_output_path: P,
    ) -> Result<bool, BridgeError>
       where P: AsRef<Path>;
    fn add_dir<P>(
        &self,
        zip_writer: &mut ZipWriter<File>,
        base_dir: P,
        current_dir: P,
    ) -> Result<bool, BridgeError>
       where P: AsRef<Path>;
    fn batch_compression<P>(
        &self,
        zip_input_paths: Vec<P>,
        zip_output_path: P,
    ) -> Result<bool, BridgeError>
       where P: AsRef<Path>;
    fn check_folder_is_empty<P>(&self, path: P) -> Result<bool, BridgeError>
       where P: AsRef<Path>;
    fn add_path<P>(
        &self,
        zip_writer: &mut ZipWriter<File>,
        path: P,
    ) -> Result<bool, BridgeError>
       where P: AsRef<Path>;
}
Expand description

zip

Required Methods§

Source

fn calculate_size<P>(&self, path: P) -> Result<f64, BridgeError>
where P: AsRef<Path>,

Calculate file size

Source

fn get_size<P>(&self, path: P) -> u64
where P: AsRef<Path>,

Read file size

Source

fn extract<P>( &self, zip_src_path: P, zip_output_path: P, ) -> Result<bool, BridgeError>
where P: AsRef<Path>,

@description: Decompression extractor @parama zip_src_path: Decompression target path @parama zip_output_path: Output Path

Source

fn file_compression<P>( &self, zip_input_path: P, zip_output_path: P, ) -> Result<bool, BridgeError>
where P: AsRef<Path>,

@description: Single file compression @parama zip_input_path: Compression target path @parama zip_output_path: Output Path

Source

fn single_folder_compression<P>( &self, zip_input_path: P, zip_output_path: P, ) -> Result<bool, BridgeError>
where P: AsRef<Path>,

@description: Single folder compression @parama zip_input_path: Compression target path @parama zip_output_path: Output Path

Source

fn add_dir<P>( &self, zip_writer: &mut ZipWriter<File>, base_dir: P, current_dir: P, ) -> Result<bool, BridgeError>
where P: AsRef<Path>,

@description: Add directory @parama zip_writer: ZipWriter @parama base_dir: Directory path @parama current_dir: Base directory

Source

fn batch_compression<P>( &self, zip_input_paths: Vec<P>, zip_output_path: P, ) -> Result<bool, BridgeError>
where P: AsRef<Path>,

batch compression Please provide a list path @parama zip_input_paths: [zip_input_path1, zip_input_path2, …] @parama zip_output_path: Output Path

Source

fn check_folder_is_empty<P>(&self, path: P) -> Result<bool, BridgeError>
where P: AsRef<Path>,

@description Check whether the folder is empty @parama path: Path

Source

fn add_path<P>( &self, zip_writer: &mut ZipWriter<File>, path: P, ) -> Result<bool, BridgeError>
where P: AsRef<Path>,

@description: Add a path to the zip file @parama zip_writer: zip_writer @parama path: Path

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§