-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
A-bodyArea: body streaming.Area: body streaming.C-featureCategory: feature. This is adding a new feature.Category: feature. This is adding a new feature.E-mediumEffort: medium. Some knowledge of how hyper internal works would be useful.Effort: medium. Some knowledge of how hyper internal works would be useful.
Milestone
Description
This has been suggested before: the current trait hyper::body::HttpBody should be renamed to hyper::Body, and the existing struct hyper::Body should be split up into more descriptive implementations. I'm coming around to that idea, so here's the full proposal.
Proposal
- Change the trait
hyper::body::HttpBodytohyper::Body - Split up the
hyper::Bodytype:hyper::body::Empty: an empty body, yielding no data or trailers. Since it never yields data, itsBuftype could even be someenum NeverBuf {}.hyper::body::Full: the full body, able to yield 1 data buffer (whathyper::Body::from(buf)is in 0.13).hyper::body::Streaming: the streaming bodies received from a remote over HTTP/1 or 2.- (Optional)
hyper::body::BoxBody
A client response would then be Response<Streaming> (as would a server Request<Streaming>), since they are streamed from the connection. Hopefully, this should make the intent clearer when you have a Request<Empty> or Response<Full>, instead of just Request<Body>.
Status: Accepted
Progress
- Remove
streamvariant - Remove Body's
Oncevariant - Make
body::Sendertype andBody::channel()constructor private. - Rename
BodytoRecvtemporarily - Rename
HttpBodyre-export toBody - Determine name for
Recvbody type #2971 - Document
hyper::bodymodule with how to use different body types #3103 - website: Add more in-depth Body guide #3104
Metadata
Metadata
Assignees
Labels
A-bodyArea: body streaming.Area: body streaming.C-featureCategory: feature. This is adding a new feature.Category: feature. This is adding a new feature.E-mediumEffort: medium. Some knowledge of how hyper internal works would be useful.Effort: medium. Some knowledge of how hyper internal works would be useful.