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

Create a cleaner/easier API #103

Open
oyvindln opened this issue Apr 17, 2021 · 1 comment
Open

Create a cleaner/easier API #103

oyvindln opened this issue Apr 17, 2021 · 1 comment

Comments

@oyvindln
Copy link
Collaborator

The current API was strung together to first sit under the miniz-compatible C API, and modified slightly later to avoid going via C and unsafe for the flate2 front-end. Other than the simple functions that do all in one the api is rather clunky to use. For most users using flate2 with this as backend is probably fine, but it would be nice to have something a bit more clean for people that want more control.

Looking for some suggestions on how to structure this.

@Lokathor
Copy link
Contributor

One thing I've wanted for PNG parsing is a way to decompress a series of slices into a single output slice. In this case, the output size will already be known from the PNG header, and a sufficiently sized slice can be provided to the library (or error if an overflow would occur because the header and the image data don't agree).

So the function signature that I'm looking for is something like this:

pub fn decompress_slices(target: &mut [u8], slices: impl Iterator<Item = &[u8]>) -> Result<(), DecompressionError>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants