pub struct ContentLength { /* private fields */ }
Expand description

The size of the entity-body, in bytes, sent to the recipient.

Specifications

Examples

use http_types::Response;
use http_types::content::{ContentLength};

let content_len = ContentLength::new(12);

let mut res = Response::new(200);
content_len.apply(&mut res);

let content_len = ContentLength::from_headers(res)?.unwrap();
assert_eq!(content_len.len(), 12);

Implementations

Create a new instance.

Create a new instance from headers.

Sets the header.

Get the HeaderName.

Get the HeaderValue.

Get the content length.

Set the content length.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.