Skip to main content

Archive

Struct Archive 

Source
pub struct Archive { /* private fields */ }
Expand description

An immutable ZIP input with a validated index and lazily verified members.

Opening validates namespace, counts, declared expansion, local headers, descriptors, and nonoverlapping member regions before decompressing files. Reading validates actual size and CRC before publishing/caching bytes. Repeated reads return the same immutable allocation. Nothing is extracted, executed, discovered as a case, or recursively opened as another archive.

The supported profile is single-volume ZIP32/ZIP64 with stored/deflated members, UTF-8 paths and no prepended executable. Ambiguous metadata end records, encryption, symlinks, special files and unsafe paths are refused.

Implementations§

Source§

impl Archive

Source

pub fn open( bytes: impl AsRef<[u8]> + Into<Arc<[u8]>>, limits: ArchiveLimits, ) -> Result<Self, Error>

Index caller-owned bytes under explicit limits without filesystem I/O. An Arc input is retained without copying. Unread payload CRCs are not certified. Expansion limits apply to the sum of all declared members.

Source

pub fn entries(&self) -> impl ExactSizeIterator<Item = &ArchiveEntry>

Members in deterministic path order, including explicit directories.

Source

pub fn original_bytes(&self) -> Arc<[u8]> ⓘ

Exact original ZIP bytes, including its comment and compression data.

Source

pub fn read(&mut self, path: &ArtifactPath) -> Result<Arc<[u8]>, Error>

Read and CRC-verify a member, caching only a complete valid payload.

Source

pub fn read_with_limit( &mut self, path: &ArtifactPath, max_bytes: u64, ) -> Result<Arc<[u8]>, Error>

Apply an additional per-read byte cap, including on cached members. A refusal does not populate the cache. Zero permits only empty members.

Source

pub fn read_cancellable( &mut self, path: &ArtifactPath, max_bytes: u64, cancel: &Cancellation, ) -> Result<Arc<[u8]>, Error>

Read with cooperative cancellation between decompressor reads.

Trait Implementations§

Source§

impl Debug for Archive

Source§

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

Formats the value using the given formatter. 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.