mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-29 00:00:18 +02:00
Implement From<S> for StreamBody<S> (#866)
Although this shadows `StreamBody::new()`, having `From` allows for trivial bounds creation on associated types. Signed-off-by: Nathaniel McCallum <[email protected]>
This commit is contained in:
@@ -57,6 +57,17 @@ pin_project! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<S> From<S> for StreamBody<S>
|
||||||
|
where
|
||||||
|
S: TryStream + Send + 'static,
|
||||||
|
S::Ok: Into<Bytes>,
|
||||||
|
S::Error: Into<BoxError>,
|
||||||
|
{
|
||||||
|
fn from(stream: S) -> Self {
|
||||||
|
Self::new(stream)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<S> StreamBody<S> {
|
impl<S> StreamBody<S> {
|
||||||
/// Create a new `StreamBody` from a [`Stream`].
|
/// Create a new `StreamBody` from a [`Stream`].
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user