mirror of
https://github.com/tokio-rs/axum.git
synced 2025-04-26 13:56:22 +02:00
axum-core/body: Implement Stream::size_hint
for BodyDataStream
(#3195)
This commit is contained in:
parent
0cb686535a
commit
b0b81746f7
1 changed files with 8 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue