GithubHelp home page GithubHelp logo

Depend on the bytes crate about http HOT 6 CLOSED

hyperium avatar hyperium commented on July 25, 2024
Depend on the bytes crate

from http.

Comments (6)

alexcrichton avatar alexcrichton commented on July 25, 2024

Seems ok to me, but I think we'll learn a lot from experience as tokio-io pushes this change throughout the community. I suspect we've still got tweaks and such to do here.

My main worry is that this would be quite a prominent dependency and would also need to be "1.0 quality", but we've committed to doing that with the Tokio stack so it will happen in time anyway.

from http.

alexcrichton avatar alexcrichton commented on July 25, 2024

That being said I think we should avoid this wherever possible. In the sense that if we can think of an ergonomic way to avoid exposing buffers that'd be great (just more flexible in general). If we must expose buffers then this seems like a good choice.

from http.

carllerche avatar carllerche commented on July 25, 2024

@alexcrichton So, the issue refers more to using bytes for storing internal data and not so much for the public API. I would agree that the public API should avoid exposing types from bytes as much as possible and limit when only necessary to avoid copies in some specialty fns.

from http.

alexcrichton avatar alexcrichton commented on July 25, 2024

Oh ok, if this is a private dependency I don't have much of an opinion here.

from http.

carllerche avatar carllerche commented on July 25, 2024

Here are the options:

  • Don't use bytes and use generics for all types that require byte storage, this will make the API painful
  • Don't use bytes and use Vec for internal byte storage, this will require significant allocations / copies and will have a large perf hit.
  • Use bytes and try to encapsulate it as much as possible.

from http.

carllerche avatar carllerche commented on July 25, 2024

I'll punt to #10 as it has a dependency on bytes.

from http.

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.