{"action":"created","issue":{"url":"https://api.github.com/repos/alexcrichton/flate2-rs/issues/14","labels_url":"https://api.github.com/repos/alexcrichton/flate2-rs/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/alexcrichton/flate2-rs/issues/14/comments","events_url":"https://api.github.com/repos/alexcrichton/flate2-rs/issues/14/events","html_url":"https://github.com/alexcrichton/flate2-rs/issues/14","id":58454586,"number":14,"title":"Decoder eats whole input stream","user":{"login":"jnvsor","id":5260644,"avatar_url":"https://avatars.githubusercontent.com/u/5260644?v=3","gravatar_id":"","url":"https://api.github.com/users/jnvsor","html_url":"https://github.com/jnvsor","followers_url":"https://api.github.com/users/jnvsor/followers","following_url":"https://api.github.com/users/jnvsor/following{/other_user}","gists_url":"https://api.github.com/users/jnvsor/gists{/gist_id}","starred_url":"https://api.github.com/users/jnvsor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnvsor/subscriptions","organizations_url":"https://api.github.com/users/jnvsor/orgs","repos_url":"https://api.github.com/users/jnvsor/repos","events_url":"https://api.github.com/users/jnvsor/events{/privacy}","received_events_url":"https://api.github.com/users/jnvsor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-02-21T10:39:35Z","updated_at":"2015-05-04T17:08:53Z","closed_at":null,"body":"As explained to me in http://stackoverflow.com/a/28641354/506962\r\n\r\n> However, it [ByRefReader] does not work when reading. It looks like `reader::ZlibDecoder` might consume all the way to the end of the underlying Reader. This could potentially be a bug or an oversight in the flate2 library."},"comment":{"url":"https://api.github.com/repos/alexcrichton/flate2-rs/issues/comments/98782008","html_url":"https://github.com/alexcrichton/flate2-rs/issues/14#issuecomment-98782008","issue_url":"https://api.github.com/repos/alexcrichton/flate2-rs/issues/14","id":98782008,"user":{"login":"nwin","id":949560,"avatar_url":"https://avatars.githubusercontent.com/u/949560?v=3","gravatar_id":"","url":"https://api.github.com/users/nwin","html_url":"https://github.com/nwin","followers_url":"https://api.github.com/users/nwin/followers","following_url":"https://api.github.com/users/nwin/following{/other_user}","gists_url":"https://api.github.com/users/nwin/gists{/gist_id}","starred_url":"https://api.github.com/users/nwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nwin/subscriptions","organizations_url":"https://api.github.com/users/nwin/orgs","repos_url":"https://api.github.com/users/nwin/repos","events_url":"https://api.github.com/users/nwin/events{/privacy}","received_events_url":"https://api.github.com/users/nwin/received_events","type":"User","site_admin":false},"created_at":"2015-05-04T17:08:53Z","updated_at":"2015-05-04T17:08:53Z","body":"My concern with your interfaces is, that you have do to all the bookkeeping about how much has been written yourself (by monitoring the change in `total_in/out` after every function call)\r\n\r\nI would either return this information \r\n\r\n```rust\r\nfn decompress(&mut self, input: &[u8], output: &mut [u8], flush: Flush) -> Result<(usize, usize)>;\r\n```\r\n\r\nupdate the slices\r\n\r\n```rust\r\nfn decompress<'a, 'b>(&mut self, input: &'a mut &'a[u8], output: &'b mut &'b mut [u8], flush: Flush) -> Result<()>;\r\n```\r\n\r\nor use a hybrid approach\r\n\r\n```rust\r\nfn decompress<'a>(&mut self, input: &[u8], output: &'a mut [u8], flush: Flush) -> Result<(usize, &'a mut [u8])>;\r\n```\r\n\r\n*Probably* the second approach is the best, but I’m afraid that it will cause most troubles with the borrow checker. The tuple in the first one is a bit ambiguous. \r\n"}}