-
Notifications
You must be signed in to change notification settings - Fork 163
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
Added compression examples #111
Conversation
Awesome thanks so much for doing this! I'll take a look now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok other than a few minor things looks great!
Could you also throw a comment at the top of each example with just a small word or two as to what it's doing at a high level?
examples/zlibdecoder-bufread.rs
Outdated
println!("{}", decode_bufreader(bytes).unwrap()); | ||
} | ||
|
||
fn decode_bufreader(bytes: Vec<u8>) -> Result<String, std::io::Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return type here may be a bit more readable as io::Result<String>
perhaps? That tends to be how Result<T, io::Error>
is referenced idiomatically
examples/zlibdecoder-bufread.rs
Outdated
} | ||
|
||
fn decode_bufreader(bytes: Vec<u8>) -> Result<String, std::io::Error> { | ||
let cursor = Cursor::new(bytes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can actually elide the Cursor
here via impl Read for &[u8]
, it'll just involve transforming bytes: Vec<u8>
to bytes: &[u8]
and then passing that into the decoder.
…xamples to be compiled into documentation. Examples are for Zlib and Gzip structs
I rebased this, I didn't like the number of commits in the PR. |
No worries! Is this ready to go? It's looking absolutely fantastic! |
I'm at a stopping point. I'll work on Deflate next. Feel free to merge this and I'll open up another PR for Deflate. |
Sounds great to me, thanks so much again @AndyGauge! |
For #76
NOT FINISHED
Before completing the decompression examples, and possibly adding other methods to the examples, I was hoping for a code review to confirm these are desired.