Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.

Add basic iterator/find support#101

Closed
Jake-Shadle wants to merge 3 commits intozip-rs:masterfrom
EmbarkStudios:master
Closed

Add basic iterator/find support#101
Jake-Shadle wants to merge 3 commits intozip-rs:masterfrom
EmbarkStudios:master

Conversation

@Jake-Shadle
Copy link
Copy Markdown

@Jake-Shadle Jake-Shadle commented Mar 20, 2019

ZipArchive is a bit cumbersome to use when you are consuming archives with unknown/variable contents, so this PR exposes 3 helper methods on ZipArchive to make it slightly easier to consume such content.

  • iter_files() - Returns an iterator over the internal vector of ZipFileData, which allows people to use all of the standard iterator goodies they are used to
  • by_id() - As with the existing by_name/by_index, returns the ZipFile if that id exists. The id can be converted from a &ZipFileData and is unique (not name based)
  • find() - While iter_files().map() + by_id() or iter_files().position() + by_index() can be used to find a file matching criteria, they are a bit cumbersome to use due to the borrow checker since iter_files() is an immutable borrow and all of by_ methods are mutable, so find just wraps the most common case of "get me the file that matches this predicate, if it exists"

@repi
Copy link
Copy Markdown
Contributor

repi commented Apr 10, 2019

Any updates or ideas on this to make it acceptable and merged in?

@mvdnes
Copy link
Copy Markdown
Collaborator

mvdnes commented Apr 21, 2019

I am sorry, but due to a lack of time I don't think I will be able to review anything from this library anytime soon.

@steven-joruk
Copy link
Copy Markdown

Sorry for going off topic Jake, I would like to see the iter part of this MR go in - @mvdnes would you consider adding other maintainers?

cosmicexplorer pushed a commit to cosmicexplorer/zip that referenced this pull request May 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants