Skip to content

Commit 01d2211

Browse files
committed
Move utilities and combinators to a separate package
Hyper works with all combinators removed, as would anything that depends on the initial 0.4 release. Removing methods from the trait is a breaking change, but it is possible to do the semver trick (release 0.5, then release 0.4.x with a dependency on the 0.5 trait) to not split the ecosystem. Addresses #52.
1 parent 6f722a1 commit 01d2211

File tree

18 files changed

+146
-88
lines changed

18 files changed

+146
-88
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ jobs:
2727
- name: Install Rust
2828
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
2929
- name: Run tests
30-
run: cargo test
30+
run: cargo test --workspace

Cargo.toml

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,3 @@
1-
[package]
2-
name = "http-body"
3-
# When releasing to crates.io:
4-
# - Remove path dependencies
5-
# - Update html_root_url.
6-
# - Update doc url
7-
# - Cargo.toml
8-
# - README.md
9-
# - Update CHANGELOG.md.
10-
# - Create "vx.y.z" git tag.
11-
version = "0.4.5"
12-
authors = [
13-
"Carl Lerche <me@carllerche.com>",
14-
"Lucio Franco <luciofranco14@gmail.com>",
15-
"Sean McArthur <sean@seanmonstar.com>",
16-
]
17-
edition = "2018"
18-
readme = "README.md"
19-
documentation = "https://docs.rs/http-body"
20-
repository = "https://github.com/hyperium/http-body"
21-
license = "MIT"
22-
description = """
23-
Trait representing an asynchronous, streaming, HTTP request or response body.
24-
"""
25-
keywords = ["http"]
26-
categories = ["web-programming"]
27-
28-
[dependencies]
29-
bytes = "1"
30-
http = "0.2"
31-
pin-project-lite = "0.2"
32-
33-
[dev-dependencies]
34-
tokio = { version = "1", features = ["macros", "rt"] }
1+
[workspace]
2+
members = ["http-body", "http-body-util"]
3+
resolver = "2"

http-body-util/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Unreleased
2+
3+
- Initial release, split from http-body 0.4.5.

http-body-util/Cargo.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[package]
2+
name = "http-body-util"
3+
# When releasing to crates.io:
4+
# - Remove path dependencies
5+
# - Update html_root_url.
6+
# - Update doc url
7+
# - Cargo.toml
8+
# - README.md
9+
# - Update CHANGELOG.md.
10+
# - Create "http-body-util-x.y.z" git tag.
11+
version = "0.1.0"
12+
authors = [
13+
"Carl Lerche <me@carllerche.com>",
14+
"Lucio Franco <luciofranco14@gmail.com>",
15+
"Sean McArthur <sean@seanmonstar.com>",
16+
]
17+
edition = "2018"
18+
readme = "README.md"
19+
documentation = "https://docs.rs/http-body-util"
20+
repository = "https://github.com/hyperium/http-body"
21+
license = "MIT"
22+
description = """
23+
Combinators and adapters for HTTP request or response bodies.
24+
"""
25+
keywords = ["http"]
26+
categories = ["web-programming"]
27+
28+
[dependencies]
29+
bytes = "1"
30+
http = "0.2"
31+
http-body = { path = "../http-body" }
32+
pin-project-lite = "0.2"
33+
34+
[dev-dependencies]
35+
tokio = { version = "1", features = ["macros", "rt"] }

src/combinators/box_body.rs renamed to http-body-util/src/combinators/box_body.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
use crate::Body;
1+
use crate::BodyExt as _;
2+
23
use bytes::Buf;
4+
use http_body::{Body, SizeHint};
35
use std::{
46
fmt,
57
pin::Pin,
@@ -60,7 +62,7 @@ where
6062
self.inner.is_end_stream()
6163
}
6264

63-
fn size_hint(&self) -> crate::SizeHint {
65+
fn size_hint(&self) -> SizeHint {
6466
self.inner.size_hint()
6567
}
6668
}
@@ -119,7 +121,7 @@ where
119121
self.inner.is_end_stream()
120122
}
121123

122-
fn size_hint(&self) -> crate::SizeHint {
124+
fn size_hint(&self) -> SizeHint {
123125
self.inner.size_hint()
124126
}
125127
}

src/combinators/map_data.rs renamed to http-body-util/src/combinators/map_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::Body;
21
use bytes::Buf;
2+
use http_body::Body;
33
use pin_project_lite::pin_project;
44
use std::{
55
any::type_name,

src/combinators/map_err.rs renamed to http-body-util/src/combinators/map_err.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::Body;
1+
use http_body::{Body, SizeHint};
22
use pin_project_lite::pin_project;
33
use std::{
44
any::type_name,
@@ -79,7 +79,7 @@ where
7979
self.inner.is_end_stream()
8080
}
8181

82-
fn size_hint(&self) -> crate::SizeHint {
82+
fn size_hint(&self) -> SizeHint {
8383
self.inner.size_hint()
8484
}
8585
}
File renamed without changes.

src/empty.rs renamed to http-body-util/src/empty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use super::{Body, SizeHint};
21
use bytes::Buf;
32
use http::HeaderMap;
3+
use http_body::{Body, SizeHint};
44
use std::{
55
convert::Infallible,
66
fmt,

src/full.rs renamed to http-body-util/src/full.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use crate::{Body, SizeHint};
21
use bytes::{Buf, Bytes};
32
use http::HeaderMap;
3+
use http_body::{Body, SizeHint};
44
use pin_project_lite::pin_project;
55
use std::borrow::Cow;
66
use std::convert::{Infallible, TryFrom};

0 commit comments

Comments
 (0)