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 ReadWrapper and WriteWrapper traits #32625

Closed
wants to merge 1 commit into from

Conversation

bozaro
Copy link

@bozaro bozaro commented Mar 30, 2016

I wrote simple binding for lz4 compression (https://github.com/bozaro/lz4-rs) and got issue bozaro/lz4-rs#9.

The main problem is: there are not best practices for writing compression (encryption and etc) libraries.
Compression libraries need some method for "finish" work: write end stream mark and flush data.
This work should not run in drop() method: I prefer unexpected end of stream instead of success on reading incomplete stream.

@kali have had a look at other implementations (std::io::BufWriter, flate2, snappy_framed, which are the ones I need to switch). The four of them are handling thing differently:

So, I think, in this case good idea to add ReadWrapper and WriteWrapper traits to rust stdlib.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@durka
Copy link
Contributor

durka commented Mar 30, 2016

Seems like this should start as an RFC.

@alexcrichton
Copy link
Member

Yes @durka is correct here, for addition to the standard library new traits like this require an RFC. I'm gonna close this for now, but let me know if you need any help writing an RFC!

@bozaro
Copy link
Author

bozaro commented Apr 1, 2016

I try with RFC: rust-lang/rfcs#1568

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.

5 participants