pub fn encode<P: AsRef<Path>>(path: P, compression: i32) -> io::Result<Self> {
        use {tar::Builder, zstd::Encoder};

        let path = path.as_ref();
        let buffer = Vec::new();

        // create archive builder with compression
        let mut builder = Builder::new(Encoder::new(buffer, compression)?);

        // add path to archive
        builder.append_dir_all(".", path)?;

        // finish streams and unpack data
        builder
            .into_inner()
            .and_then(Encoder::finish)
            .map(|data| Self { data })
    }
/// Archives the directory at `path` and compresses it with a of compression level `compression`.
/// # Errors
/// Returns `std::io::Error` when opening the encoder `zstd::Encoder`,
/// inserting the directory at `path` into the `tar::Builder` or
/// finishing the `tar::Builder` failed.
Archives the directory at `path` and compresses it with a of compression level `compression`.
Archives the directory at ` path ` and compresses it with a of compression level ` compression ` .
pub fn encode<P: AsRef<Path>>(path: P, compression: i32) -> io::Result<Self> {
        use {tar::Builder, zstd::Encoder};
        let path = path.as_ref();
        let buffer = Vec::new();
        // create archive builder with compression
        let mut builder = Builder::new(Encoder::new(buffer, compression)?);
        // add path to archive
        builder.append_dir_all(".", path)?;
        // finish streams and unpack data
        builder
            .into_inner()
            .and_then(Encoder::finish)
            .map(|data| Self { data })
    }
pub fn encode < P : AsRef < Path > > ( path : P , compression : i32 ) -> io :: Result < Self > { use { tar :: Builder , zstd :: Encoder } ; let path = path . as_ref ( ) ; let buffer = Vec :: new ( ) ; // create archive builder with compression let mut builder = Builder :: new ( Encoder :: new ( buffer , compression ) ? ) ; // add path to archive builder . append_dir_all ( " " , path ) ? ; // finish streams and unpack data builder . into_inner ( ) . and_then ( Encoder :: finish ) . map ( | data | Self { data } ) }
Archives the directory at `path` and compresses it with a of compression level `compression`.
Archives the directory at ` path ` and compresses it with a of compression level ` compression ` .
path
P
compression
i32
path
P
compression
i32
errors
Returns `std::io::Error` when opening the encoder `zstd::Encoder`,
inserting the directory at `path` into the `tar::Builder` or
finishing the `tar::Builder` failed.
Returns ` std :: io :: Error ` when opening the encoder ` zstd :: Encoder ` inserting the directory at ` path ` into the ` tar :: Builder ` or finishing the ` tar :: Builder ` failed .