Giter Site home page Giter Site logo

Comments (7)

kanekv avatar kanekv commented on May 30, 2024 1

golang follows this pattern everywhere, e.g.: https://golang.org/pkg/encoding/base64/#NewDecoder

from rust-base64.

marshallpierce avatar marshallpierce commented on May 30, 2024

That would be convenient, for sure, but I don't see a clear path to make it fast. A big part of the reason the crate is fast is that it can decode and encode from slices.

from rust-base64.

partim avatar partim commented on May 30, 2024

A compromise would be to allow decoding a sequence of slices. It would just have to keep some state from the potentially incomplete end of a slice between iterations.

from rust-base64.

marshallpierce avatar marshallpierce commented on May 30, 2024

That sounds like the decode-side equivalent of the existing EncoderWriter. Shouldn't be too hard to adapt an iterator to a Read, I would imagine...

from rust-base64.

partim avatar partim commented on May 30, 2024

Perhaps a DecoderWriter would be more convenient? I.e., a writer that is fed encoded data and writes decoded data to the underlying writer. That works neatly atop a vec.

from rust-base64.

AlexTMjugador avatar AlexTMjugador commented on May 30, 2024

My two cents here: with a crate like iter_read you can easily turn an iterator over bytes to a Read that can then be used with the DecoderReader struct of this crate. This doesn't involve collecting the entire input data to a temporary buffer again.

from rust-base64.

marshallpierce avatar marshallpierce commented on May 30, 2024

That sounds like a good solution. (The DecoderReader will buffer chunks internally, so there's still some buffering.)

from rust-base64.

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.