Skip to content

Commit

Permalink
Add conversions into UnsyncBoxBody
Browse files Browse the repository at this point in the history
  • Loading branch information
nanoqsh committed Dec 24, 2024
1 parent d0c522b commit ad5d96f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tower-http/src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ where
}
}

impl<D, E> From<UnsyncBoxBody<D, E>> for http_body_util::combinators::UnsyncBoxBody<D, E> {
fn from(body: UnsyncBoxBody<D, E>) -> Self {
body.inner
}
}

impl<D, E> UnsyncBoxBody<D, E> {
#[allow(dead_code)]
pub(crate) fn new(inner: http_body_util::combinators::UnsyncBoxBody<D, E>) -> Self {
Expand Down
6 changes: 6 additions & 0 deletions tower-http/src/services/fs/serve_dir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,12 @@ opaque_body! {
pub type ResponseBody = UnsyncBoxBody<Bytes, io::Error>;
}

impl From<ResponseBody> for http_body_util::combinators::UnsyncBoxBody<Bytes, io::Error> {
fn from(body: ResponseBody) -> Self {
body.inner.inner
}
}

/// The default fallback service used with [`ServeDir`].
#[derive(Debug, Clone, Copy)]
pub struct DefaultServeDirFallback(Infallible);
Expand Down

0 comments on commit ad5d96f

Please sign in to comment.