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 Freeze for ContentLength
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