Closed cosmicexplorer closed 5 months ago
It's currently difficult to use this crate in async Rust code. One reason for that is the requirement that all captured variables in closures for most async executors must be Send + 'static, neither of which is true for ZipFile<'a> right now, requiring unsafe workarounds for the lifetime rules (e.g. casting a pointer to a usize, as in https://github.com/cosmicexplorer/symbolic-fs/blob/827a71e72cd7e3f5b7fd3fe2a0f3ad836508eff6/handles/src/lib.rs#L479).
async
Send + 'static
ZipFile<'a>
unsafe
This change does two things:
ZipFile<S>
S
Limiter<S>
io::Take<&mut dyn R>
This is unfortunately a breaking change because ZipFile is a public API.
ZipFile
This repo is no longer maintained. Could you please rebase this PR against https://github.com/zip-rs/zip2 and submit it there?
It's currently difficult to use this crate in
async
Rust code. One reason for that is the requirement that all captured variables in closures for most async executors must beSend + 'static
, neither of which is true forZipFile<'a>
right now, requiringunsafe
workarounds for the lifetime rules (e.g. casting a pointer to a usize, as in https://github.com/cosmicexplorer/symbolic-fs/blob/827a71e72cd7e3f5b7fd3fe2a0f3ad836508eff6/handles/src/lib.rs#L479).This change does two things:
ZipFile<S>
by the type of the inner readable streamS
, and remove the lifetime requirement.Limiter<S>
to perform the role ofio::Take<&mut dyn R>
.This is unfortunately a breaking change because
ZipFile
is a public API.