diff --git a/src/body.rs b/src/body.rs
index ca8acb69..33ac1960 100644
--- a/src/body.rs
+++ b/src/body.rs
@@ -1,8 +1,7 @@
//! HTTP body utilities.
use bytes::Bytes;
-use http_body::{Empty, Full, SizeHint};
-use pin_project::pin_project;
+use http_body::{Empty, Full};
use std::{
error::Error as StdError,
fmt,
@@ -34,6 +33,16 @@ impl BoxBody {
inner: Box::pin(body.map_err(|error| BoxStdError(error.into()))),
}
}
+
+ pub(crate) fn empty() -> Self {
+ Self::new(Empty::new())
+ }
+}
+
+impl Default for BoxBody {
+ fn default() -> Self {
+ BoxBody::empty()
+ }
}
impl fmt::Debug for BoxBody {
@@ -96,103 +105,3 @@ impl fmt::Display for BoxStdError {
self.0.fmt(f)
}
}
-
-/// Type that combines two body types into one.
-#[pin_project]
-#[derive(Debug)]
-pub struct Or(#[pin] Either);
-
-impl Or {
- #[inline]
- pub(crate) fn a(a: A) -> Self {
- Or(Either::A(a))
- }
-
- #[inline]
- pub(crate) fn b(b: B) -> Self {
- Or(Either::B(b))
- }
-}
-
-impl Default for Or {
- fn default() -> Self {
- Self(Either::Empty(Empty::new()))
- }
-}
-
-#[pin_project(project = EitherProj)]
-#[derive(Debug)]
-enum Either {
- Empty(Empty), // required for `Default`
- A(#[pin] A),
- B(#[pin] B),
-}
-
-impl http_body::Body for Or
-where
- A: http_body::Body,
- A::Error: Into,
- B: http_body::Body,
- B::Error: Into,
-{
- type Data = Bytes;
- type Error = BoxStdError;
-
- #[inline]
- fn poll_data(
- self: Pin<&mut Self>,
- cx: &mut Context<'_>,
- ) -> Poll