Skip to main content

ArchiveHandler

Trait ArchiveHandler 

Source
pub trait ArchiveHandler {
    // Required methods
    fn pack(
        &self,
        files: &[(&str, &[u8])],
        format: ArchiveFormat,
    ) -> Result<Bytes, ArchiveError>;
    fn unpack(
        &self,
        archive: &[u8],
        format: ArchiveFormat,
    ) -> Result<Vec<(String, Bytes)>, ArchiveError>;
}
Expand description

Multi-carrier archive port (ZIP / TAR / TAR.GZ).

Required Methods§

Source

fn pack( &self, files: &[(&str, &[u8])], format: ArchiveFormat, ) -> Result<Bytes, ArchiveError>

Pack files (name, bytes) into an archive of format.

§Errors

Returns ArchiveError::PackFailed or ArchiveError::UnsupportedFormat.

Source

fn unpack( &self, archive: &[u8], format: ArchiveFormat, ) -> Result<Vec<(String, Bytes)>, ArchiveError>

Unpack archive of format into (name, bytes) pairs.

§Errors

Returns ArchiveError::UnpackFailed or ArchiveError::UnsupportedFormat.

Implementors§