pub trait AsSendBody {
// Required method
fn into_send_body(self) -> Body;
// Provided method
fn content_length(&self) -> Option<u64> { ... }
}Expand description
A trait for types that can be converted into an HTTP request body with optional size information.
Implementations return Some(len) when the body size is known
ahead of time (allowing Content-Length to be set), or None when
the size is unknown (requiring Transfer-Encoding: chunked).
Required Methods§
Sourcefn into_send_body(self) -> Body
fn into_send_body(self) -> Body
Convert this value into a Body.
Provided Methods§
Sourcefn content_length(&self) -> Option<u64>
fn content_length(&self) -> Option<u64>
Returns the content length if known ahead of time.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".