Skip to main content

Crate use_archive

Crate use_archive 

Source
Expand description

§use-archive

Feature-gated facade crate for RustUse archive primitives.

This crate re-exports focused archive vocabulary crates from the use-archive workspace. It is intentionally primitive-only: it describes archive formats, compression codecs, entry metadata, manifests, paths, and policies, but does not read, write, extract, compress, decompress, decrypt, or mount archive data.

§Example

use use_archive::{
    ArchiveEncoding, ArchiveEntry, ArchiveEntryKind, ArchiveFormat, ArchiveManifest,
    ArchivePolicy, CompressionFormat, is_safe_relative_archive_path,
};

let encoding = ArchiveEncoding::from_extension("release.tar.zst");
assert_eq!(encoding.archive, ArchiveFormat::Tar);
assert_eq!(encoding.compression, CompressionFormat::Zstd);

assert!(is_safe_relative_archive_path("docs/readme.md"));

let policy = ArchivePolicy::strict();
assert!(!policy.allow_symlinks);

let manifest = ArchiveManifest::new(encoding).with_entries(vec![
    ArchiveEntry::new("docs/readme.md", ArchiveEntryKind::File).with_size(128),
]);

assert_eq!(manifest.file_count(), 1);

Thin facade for primitive archive vocabulary crates.

Re-exports§

pub use use_7z as seven_zip;
pub use use_ar as ar;
pub use use_archive_entry as entry;
pub use use_archive_format as format;
pub use use_archive_manifest as manifest;
pub use use_archive_path as path;
pub use use_archive_policy as policy;
pub use use_brotli as brotli;
pub use use_bzip2 as bzip2;
pub use use_cab as cab;
pub use use_compression as compression;
pub use use_cpio as cpio;
pub use use_gzip as gzip;
pub use use_iso as iso;
pub use use_lz4 as lz4;
pub use use_mtree as mtree;
pub use use_rar as rar;
pub use use_tar as tar;
pub use use_warc as warc;
pub use use_xz as xz;
pub use use_zip as zip;
pub use use_zstd as zstd;

Modules§

prelude
Common archive primitive re-exports.

Structs§

ArchiveEncoding
Archive container plus outer compression wrapper.
ArchiveEntry
Generic archive entry metadata.
ArchiveManifest
A normalized listing of archive entries.
ArchivePolicy
Policy primitives for safe extraction planning.
CompressionSettings
Generic compression settings metadata.
GzipOptions
Gzip option metadata.
XzOptions
XZ option metadata.
ZstdOptions
Zstd option metadata.

Enums§

ArEntryKind
Unix ar entry kind labels.
ArFormat
Unix ar format labels.
ArchiveEntryKind
Generic archive entry kinds.
ArchiveFormat
Archive container formats.
ArchivePathIssue
Issues found in an archive-internal path.
ArchivePolicyIssue
Policy violations detected for archive entries or entry lists.
BrotliExtension
Brotli extension labels.
BrotliLevel
Brotli compression level labels.
BrotliProfile
High-level Brotli usage profile.
Bzip2Extension
Bzip2 extension labels.
Bzip2Level
Bzip2 compression level labels.
Bzip2Profile
High-level bzip2 usage profile.
CabCompressionMethod
CAB compression method labels.
CabFormat
Microsoft Cabinet format labels.
CompressionFormat
Compression codecs commonly wrapped around archive payloads.
CompressionIntent
Intent behind a compression choice.
CompressionLevel
Generic compression level labels.
CpioEntryKind
CPIO entry kind labels.
CpioFormat
CPIO format variant labels.
GzipHeaderMode
Metadata strategy for gzip headers.
IsoFormat
ISO image format labels.
IsoVolumeKind
ISO volume kind labels.
Lz4Extension
LZ4 extension labels.
Lz4FrameKind
LZ4 frame kind labels.
Lz4Profile
High-level LZ4 usage profile.
MtreeEntryKind
mtree entry kind labels.
MtreeFormat
mtree dialect labels.
MtreeKeyword
mtree keyword labels.
RarVersion
RAR version labels.
RarVolumeKind
RAR volume kind labels.
SevenZipCompressionMethod
7-Zip compression method labels.
SevenZipFormat
7-Zip archive format labels.
TarEntryType
Tar entry type labels.
WarcFormat
Web archive format labels.
WarcRecordKind
WARC record kind labels.
XzCheckType
XZ integrity check labels.
ZipCompressionMethod
ZIP compression methods.
ZstdFrameKind
Zstd frame shape labels.

Constants§

ARC_EXTENSION
Common ARC extension.
ARC_GZIP_EXTENSION
Common gzip-compressed ARC extension.
AR_EXTENSION
Common Unix ar extension.
AR_EXTENSIONS
Common ar-related extensions.
AR_STATIC_LIBRARY_EXTENSION
Common static-library archive extension.
BROTLI_EXTENSION
Common Brotli file extension.
BROTLI_EXTENSIONS
Common Brotli-related extensions.
BZIP2_EXTENSION
Common bzip2 file extension.
BZIP2_EXTENSIONS
Common bzip2-related extensions.
CAB_EXTENSION
Common Microsoft Cabinet archive extension.
CAB_EXTENSIONS
Common CAB-related extensions.
CPIO_EXTENSION
Common CPIO file extension.
CPIO_EXTENSIONS
Common CPIO-related extensions.
CPIO_GZIP_EXTENSION
Common gzip-compressed CPIO extension.
CPIO_XZ_EXTENSION
Common xz-compressed CPIO extension.
CPIO_ZSTD_EXTENSION
Common zstd-compressed CPIO extension.
DEBIAN_PACKAGE_EXTENSION
Common Debian package extension backed by ar containers.
GZIP_ENCODING_LABEL
Common HTTP content-encoding label for gzip.
GZIP_EXTENSION
Common gzip file extension.
GZIP_EXTENSIONS
Common gzip-related extensions.
GZIP_MEDIA_TYPE
Common gzip media type.
IMAGE_EXTENSION
Common disk image extension used for ISO-like artifacts.
ISO_EXTENSION
Common ISO image extension.
ISO_EXTENSIONS
Common ISO-related extensions.
LZ4_EXTENSION
Common LZ4 file extension.
LZ4_EXTENSIONS
Common LZ4-related extensions.
LZMA_LABEL
Common LZMA label.
MTREE_EXTENSION
Common mtree manifest extension.
MTREE_EXTENSIONS
Common mtree-related extensions.
MTREE_GZIP_EXTENSION
Common gzip-compressed mtree manifest extension.
RAR_EXTENSION
Common RAR archive extension.
RAR_EXTENSIONS
Common RAR-related extensions.
RAR_OLD_PART_EXTENSION
Common old-style RAR multipart extension.
RAR_PART1_EXTENSION
Common new-style RAR multipart filename extension.
SEVEN_ZIP_EXTENSION
Common 7-Zip archive extension.
SEVEN_ZIP_EXTENSIONS
Common 7-Zip-related extensions.
SEVEN_ZIP_FIRST_VOLUME_EXTENSION
Common first split-volume 7-Zip extension.
TAR_BROTLI_EXTENSION
Common Brotli-compressed tar extension.
TAR_BZIP2_EXTENSION
Common bzip2-compressed tar extension.
TAR_EXTENSION
Common tar file extension.
TAR_GZIP_EXTENSION
Common gzip-compressed tar extension.
TAR_LZ4_EXTENSION
Common LZ4-compressed tar extension.
TAR_XZ_EXTENSION
Common xz-compressed tar extension.
TAR_ZSTD_EXTENSION
Common zstd-compressed tar extension.
TBZ2_EXTENSION
Common abbreviated bzip2-compressed tar extension.
TBZ_EXTENSION
Common abbreviated bzip2-compressed tar extension.
WARC_EXTENSION
Common WARC extension.
WARC_EXTENSIONS
Common WARC/ARC-related extensions.
WARC_GZIP_EXTENSION
Common gzip-compressed WARC extension.
XZ_EXTENSION
Common xz file extension.
XZ_EXTENSIONS
Common xz-related extensions.
ZIP_EXTENSION
Common ZIP file extension.
ZSTD_EXTENSION
Common zstd file extension.
ZSTD_EXTENSIONS
Common zstd-related extensions.
ZSTD_LABEL
Common Zstandard label.

Functions§

archive_path_issues
Returns all detected safety issues for an archive-internal path.
is_7z_extension
Returns whether extension is a known 7-Zip extension label.
is_7z_filename
Returns whether name has a known 7-Zip filename encoding.
is_ar_extension
Returns whether extension is a known ar extension label.
is_ar_filename
Returns whether name has a known ar filename encoding.
is_brotli_extension
Returns whether extension is a known Brotli extension label.
is_brotli_filename
Returns whether name has a known Brotli filename encoding.
is_bzip2_extension
Returns whether extension is a known bzip2 extension label.
is_bzip2_filename
Returns whether name has a known bzip2 filename encoding.
is_cab_extension
Returns whether extension is a known CAB extension label.
is_cab_filename
Returns whether name has a known CAB filename encoding.
is_cpio_extension
Returns whether extension is a known CPIO extension label.
is_cpio_filename
Returns whether name has a known CPIO filename encoding.
is_iso_extension
Returns whether extension is a known ISO image extension label.
is_iso_filename
Returns whether name has a known ISO image filename encoding.
is_lz4_extension
Returns whether extension is a known LZ4 extension label.
is_lz4_filename
Returns whether name has a known LZ4 filename encoding.
is_mtree_extension
Returns whether extension is a known mtree extension label.
is_mtree_filename
Returns whether name has a known mtree filename encoding.
is_rar_extension
Returns whether extension is a known RAR extension label.
is_rar_filename
Returns whether name has a known RAR filename encoding.
is_safe_relative_archive_path
Returns whether an archive-internal path is safe and relative.
is_warc_extension
Returns whether extension is a known WARC/ARC extension label.
is_warc_filename
Returns whether name has a known WARC/ARC filename encoding.