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#101Jake-Shadle wants to merge 3 commits intozip-rs:masterfrom EmbarkStudios:master
Jake-Shadle wants to merge 3 commits intozip-rs:masterfrom
EmbarkStudios:master
Conversation
26 tasks
Contributor
|
Any updates or ideas on this to make it acceptable and merged in? |
Collaborator
|
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. |
|
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
Remove `num_enum`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 toby_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, sofindjust wraps the most common case of "get me the file that matches this predicate, if it exists"