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
impl Index
Sourcepub fn entries(&self) -> &[IndexedEntry]
pub fn entries(&self) -> &[IndexedEntry]
Borrows indexed members, without fetching local records or payloads.
Sourcepub fn resolved(&self, index: usize) -> Option<Entry<'_>>
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.
Sourcepub async fn read<R: AsyncRead + AsyncSeek + Unpin>(
reader: &mut R,
) -> Result<Self, Error>
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.
Sourcepub async fn read_with_policy<R: AsyncRead + AsyncSeek + Unpin>(
reader: &mut R,
policy: IndexPolicy,
) -> Result<Self, Error>
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.
Sourcepub async fn entry<R: AsyncRead + AsyncSeek + Unpin>(
&mut self,
reader: &mut R,
index: usize,
) -> Result<Option<Entry<'_>>, Error>
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.
Sourcepub async fn validate_all<R: AsyncRead + AsyncSeek + Unpin>(
&mut self,
reader: &mut R,
) -> Result<(), Error>
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.