expression

Inspect a body size hint

A size hint reports information known by the body implementation. Full knows its exact remaining byte count; other bodies may not know their total length. Treat hints as planning information, not a substitute for checking received bytes. In-memory fixture; no external connection. Expected stdout (not executed): Some(5) Common mistake: Assuming every streamed body has an exact size.

Formal Syntax & Structure

rust syntaxrust
Body::size_hint().exact() -> Option<u64>

Working Example

Example Snippetrust
#[tokio::main(flavor = "current_thread")]async fn main() {    use hyper::body::{Body, Bytes};    use http_body_util::Full;    let body = Full::new(Bytes::from_static(b"melon"));    println!("{:?}", body.size_hint().exact());}
Rust Reference