Majored / rs-async-zip

An asynchronous ZIP archive reading/writing crate.
MIT License
123 stars 40 forks source link

OwnedEntryStreamWriter #99

Closed soooch closed 10 months ago

soooch commented 1 year ago

an alternative API to write_entry_stream:

Helpful if the writer ever needs to be stored due to the inherent issues with self referential structs.

sketched out:

impl ZipFileWriter {
    async fn to_entry_stream<E: Into<ZipEntry>>(self, entry: E) -> Result<OwnedEntryStreamWriter, ZipFileWriter> {
        ...
        Ok(OwnedEntryStream { outer: self, ... })
    }
}

impl OwnedEntryStreamWriter {
    async fn to_zip_writer(self) -> Result<ZipFileWriter, OwnedEntryStreamWriter> {
        self.close().await?;
        Ok(self.outer)
    }
}
soooch commented 1 year ago

would there be any interest in a PR?

Majored commented 10 months ago

Apologies for the delay.

I was planning on re-implementing the writer as a type-driven API (like the current stream reader), so it's probably not something that's worth exploring right now (unless you really want to). I'll let you know via this issue if I decide to ditch that plan in the future. 👍