Struct http_types::content::ContentLength [−][src]
pub struct ContentLength { /* fields omitted */ }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
impl ContentLength[src]
impl ContentLength[src]pub fn new(length: u64) -> Self[src]
Create a new instance.
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>[src]
Create a new instance from headers.
pub fn apply(&self, headers: impl AsMut<Headers>)[src]
Sets the header.
pub fn name(&self) -> HeaderName[src]
Get the HeaderName.
pub fn value(&self) -> HeaderValue[src]
Get the HeaderValue.
pub fn len(&self) -> u64[src]
Get the content length.
pub fn set_len(&mut self, len: u64)[src]
Set the content length.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ContentLength
impl RefUnwindSafe for ContentLengthimpl Send for ContentLength
impl Send for ContentLengthimpl Sync for ContentLength
impl Sync for ContentLengthimpl Unpin for ContentLength
impl Unpin for ContentLengthimpl UnwindSafe for ContentLength
impl UnwindSafe for ContentLength