Struct ajars_surf::surf::http::content::ContentLength
[−]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
impl ContentLength
impl ContentLength
pub fn new(length: u64) -> ContentLength
pub fn new(length: u64) -> ContentLength
Create a new instance.
pub fn from_headers(
headers: impl AsRef<Headers>
) -> Result<Option<ContentLength>, Error>
pub fn from_headers(
headers: impl AsRef<Headers>
) -> Result<Option<ContentLength>, Error>
Create a new instance from headers.
pub fn name(&self) -> HeaderName
pub fn name(&self) -> HeaderName
Get the HeaderName
.
pub 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more