Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for readers that implement Seek (#218) #266

Merged
merged 1 commit into from Oct 6, 2021

Conversation

fermeise
Copy link
Contributor

@fermeise fermeise commented Oct 4, 2021

Archive::new requires only Read for backward-compatibility, while
Archive::new_from_seek can be used with readers that also implement
Seek, to allow more efficient skipping over file contents.

Copy link
Owner

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! This is definitely something I think that's worth implementing. I've got a few comments below, but I think this is going in a good direction.

src/skip.rs Outdated Show resolved Hide resolved
src/skip.rs Outdated Show resolved Hide resolved
src/archive.rs Outdated Show resolved Hide resolved
src/archive.rs Outdated Show resolved Hide resolved
Copy link
Owner

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me, thanks!

src/archive.rs Outdated Show resolved Hide resolved
src/archive.rs Outdated Show resolved Hide resolved
done: false,
next: 0,
raw: false,
})
}

fn _unpack(&mut self, dst: &Path) -> io::Result<()> {
fn _unpack(&'a mut self, dst: &Path) -> io::Result<()> {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this 'a may no longer be necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rustc seems to need this to determine the lifetime of the seekable_archive argument when calling _entries().

src/archive.rs Outdated Show resolved Hide resolved
src/archive.rs Outdated Show resolved Hide resolved
`Archive::entries_with_seek` can be used to get an iterator over
entries for a reader that implements `Seek`.
@alexcrichton
Copy link
Owner

Ok looks great to me, thanks!

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.

None yet

2 participants