mirror of
https://github.com/tokio-rs/axum.git
synced 2025-01-01 00:50:32 +01: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 <nathaniel@profian.com>
This commit is contained in:
parent
a0ae0c48aa
commit
30b2cf8f96
1 changed files with 11 additions and 0 deletions
|
@ -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> {
|
||||
/// Create a new `StreamBody` from a [`Stream`].
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue