Skip to main content

AsSendBody

Trait AsSendBody 

Source
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§

Source

fn into_send_body(self) -> Body

Convert this value into a Body.

Provided Methods§

Source

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".

Implementations on Foreign Types§

Source§

impl AsSendBody for &'static [u8]

Source§

impl AsSendBody for &'static str

Source§

impl AsSendBody for ()

Source§

impl AsSendBody for Bytes

Source§

impl AsSendBody for String

Source§

impl AsSendBody for Vec<u8>

Implementors§