mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-07 00:00:12 +02:00
axum-core/body: Implement Stream::size_hint for BodyDataStream (#3195)
This commit is contained in:
@@ -155,6 +155,14 @@ impl Stream for BodyDataStream {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||||
|
let size_hint = self.inner.size_hint();
|
||||||
|
let lower = usize::try_from(size_hint.lower()).unwrap_or_default();
|
||||||
|
let upper = size_hint.upper().and_then(|v| usize::try_from(v).ok());
|
||||||
|
(lower, upper)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl http_body::Body for BodyDataStream {
|
impl http_body::Body for BodyDataStream {
|
||||||
|
|||||||
Reference in New Issue
Block a user