Skip to main content

Index

Struct Index 

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

A ZIP member index.

This is constructed from the central directory, with referenced local file entries being resolved lazily upon access through Self::entry.

Implementations§

Source§

impl Index

Source

pub fn entries(&self) -> &[IndexedEntry]

Borrows indexed members, without fetching local records or payloads.

Source

pub fn resolved(&self, index: usize) -> Option<Entry<'_>>

Returns a previously checked entry by index, without performing I/O.

Returns None if the index is out of bounds or the member is unresolved.

Source

pub async fn read<R: AsyncRead + AsyncSeek + Unpin>( reader: &mut R, ) -> Result<Self, Error>

Indexes the directory with the default IndexPolicy.

Local headers and descriptors are checked by Self::entry on access, or by Self::validate_all. The source must remain unchanged and be the same source passed to subsequent operations. A cancelled read may leave its cursor anywhere; another call restarts from the end.

Source

pub async fn read_with_policy<R: AsyncRead + AsyncSeek + Unpin>( reader: &mut R, policy: IndexPolicy, ) -> Result<Self, Error>

Indexes the directory with the supplied policy and checks bounds derivable from its records.

The policy also applies when checking local records. See Self::read for requirements on the source.

Source

pub async fn entry<R: AsyncRead + AsyncSeek + Unpin>( &mut self, reader: &mut R, index: usize, ) -> Result<Option<Entry<'_>>, Error>

Checks one member’s local header, extras and descriptor before exposing it.

Successful resolutions are cached. This does not decode or check payload contents. The source must be the immutable source used by Self::read.

Source

pub async fn validate_all<R: AsyncRead + AsyncSeek + Unpin>( &mut self, reader: &mut R, ) -> Result<(), Error>

Checks every local header, descriptor, and kind, including unselected members.

Success establishes complete, non-overlapping record coverage and agreement of redundant and kind-specific metadata except timestamps and Windows NT security descriptor sizes. Payload sizes and CRCs still need to be verified when decoding. Already checked members require no I/O.

Trait Implementations§

Source§

impl Debug for Index

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Index

§

impl Freeze for Index

§

impl Move for Index

§

impl RefUnwindSafe for Index

§

impl Send for Index

§

impl Sync for Index

§

impl Unpin for Index

§

impl UnsafeUnpin for Index

§

impl UnwindSafe for Index

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.