feat: add len, is_empty and entry to ZipArchiveMetadata by ethanol1310 · Pull Request #1015 · zip-rs/zip2 · GitHub
Skip to content

feat: add len, is_empty and entry to ZipArchiveMetadata - #1015

Merged
Pr0methean merged 1 commit into
zip-rs:masterfrom
ethanol1310:feat/archive-metadata-entry
Sep 28, 2026
Merged

Pr0methean merged 1 commit into
zip-rs:masterfrom
ethanol1310:feat/archive-metadata-entry

Conversation

@ethanol1310

@ethanol1310 ethanol1310 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1012.

We're working on streaming large archives and we plan the work from the central directory first, then open readers only for the entries we actually need. by_index reads the local header for each entry and needs &mut, and by_index_data avoids that but still needs the ZipArchive<R> around. What we really want is to pass Arc<ZipArchiveMetadata> to other threads and read entries from it directly, without carrying a reader.

So this adds len, is_empty and entry on ZipArchiveMetadata. entry returns the same ZipFileEntry as by_index_data (and FileNotFound when out of range), and by_index_data / ZipArchive::len now just call into it. Added a couple of tests comparing entry(i) against by_index(i).

  • The PR title conforms to Conventional Commits.

@ethanol1310

Copy link
Copy Markdown
Contributor Author

@Pr0methean
Pr0methean added this pull request to the merge queue Sep 28, 2026
Merged via the queue into zip-rs:master with commit bf7d7e2 Sep 28, 2026
134 checks passed
@Pr0methean Pr0methean mentioned this pull request Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants