Giter VIP home page Giter VIP logo

Comments (2)

alexcrichton avatar alexcrichton commented on June 11, 2024

Thanks for the report! This came up in the past with #14 (I think with even the same use case!), which eventually prompted the creation of the Decompress struct for dealing with raw in-memory decompression (e.g. no extra buffering). That being said I can see where it's much nicer to use the stream API, so I'd be totally down for beefing it up!

First, although all streams and such have R: Read as a type parameter, &mut R also satisfies this which means you don't actually have to pass ownership of the file into the deflate streams. Instead you can pass a mutable reference and then once the deflate stream is destroyed you can continue to use the underlying stream (e.g. seek it to the right position and whatnot).

I agree that dealing with Seek directly would be a little unfortunate, so I think a good way to move forward here would be to expose a method like consumed_bytes you mentioned. Does that sound ok for your use case?

from flate2-rs.

joshuawarner32 avatar joshuawarner32 commented on June 11, 2024

I think with even the same use case.

Yep, indeed. I'm glad other people are thinking along the same lines; it means I'm not totally crazy :)

First, although all streams and such have R: Read as a type parameter, &mut R also satisfies this which means you don't actually have to pass ownership of the file into the deflate streams.

Ah, perfect! Today I learned...

Does that sound ok for your use case?

Yep, that'll do nicely. I'll take a stab at putting that together.

from flate2-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.