Skip to content

Split trait into http-body-core crate #52

Closed
@Kestrer

Description

@Kestrer

The http-body crate has been gradually accumulating more utilities in it. This is a good thing, but it runs into the problem that breaking changes to any one of these utilities can cause a major ecosystem breakage, since even if trait Body defined in http-body 0.4 and 0.5 are the exact same trait signature-wise, Rust still treats them as entirely separate traits and will not allow them to interact. This also results in very confusing error messages that usually say something like "expected http_body::Body, found http_body::Body".

To solve this, this crate can be split into two (à la tower-service/tower-layer/tower, rand-core/rand and futures-core/futures-io/futures-sink/futures): http-body-core that contains only the definition of the trait itself, and http-body that contains BodyExt and all the useful utilities. With this design, if we were to release http-body v0.5 that contains breaking changes to the utilities but not the trait, it could re-export the old trait from the same version of http-body-core and there would be basically no breakage at all - both versions of http-body would be able to seamlessly coëxist and interoperate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions