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

Support writers without static lifetimes #55

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tofay
Copy link

@tofay tofay commented Oct 1, 2024

I've been trying to use this crate with https://github.com/containers/ocidir-rs to create container images. Getting that working required two changes to gzp:

  • the ability to return the underlying writer from Zwriter::finish
  • the ability to use borrowed writers in ParCompressBuilder::from_borrowed_writer

The latter is accomplished by allowing users to provide a https://doc.rust-lang.org/stable/std/thread/struct.Scope.html alongside the writer - the writer thread is then spawned using this scope.

ParCompressBuilder::from_borrowed_writer takes a writer and
a std::thread::Scope reference. The writer thread is spawned using
the scope, so the writer needn't have a 'static lifetime.
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.

1 participant