Struct http_types::content::ContentLength
source · 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§
source§impl ContentLength
impl ContentLength
sourcepub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
Create a new instance from headers.
sourcepub fn name(&self) -> HeaderName
pub fn name(&self) -> HeaderName
Get the HeaderName
.
sourcepub fn value(&self) -> HeaderValue
pub fn value(&self) -> HeaderValue
Get the HeaderValue
.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for ContentLength
impl Send for ContentLength
impl Sync for ContentLength
impl Unpin for ContentLength
impl UnwindSafe for ContentLength
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more