Get a value for the length of this `Body`'s content, in bytes, if known. This value can come from either the Content-Length header received in the incoming request or response assocated with the body, or be provided by an exact `http_body::Body::size_hint` if the `Body` is constructed from an `http_body::Body` impl.
(&self)
| 190 | /// or be provided by an exact `http_body::Body::size_hint` if the `Body` |
| 191 | /// is constructed from an `http_body::Body` impl. |
| 192 | pub fn content_length(&self) -> Option<u64> { |
| 193 | match &self.0 { |
| 194 | BodyInner::Boxed(b) => b.size_hint().exact(), |
| 195 | BodyInner::Complete { data, .. } => Some(data.len() as u64), |
| 196 | BodyInner::Incoming(i) => i.size_hint.content_length(), |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | /// Construct an empty Body |
| 201 | pub fn empty() -> Self { |