pub struct ContentLocation { /* private fields */ }
Expand description
Indicates an alternate location for the returned data.
§Specifications
§Examples
use http_types::{Response, Url};
use http_types::content::ContentLocation;
let content_location = ContentLocation::new(Url::parse("https://example.net/")?);
let mut res = Response::new(200);
content_location.apply(&mut res);
let url = Url::parse("https://example.net/")?;
let content_location = ContentLocation::from_headers(url, res)?.unwrap();
assert_eq!(content_location.location(), &Url::parse("https://example.net/")?);
Implementations§
Source§impl ContentLocation
impl ContentLocation
Sourcepub fn from_headers<U>(
base_url: U,
headers: impl AsRef<Headers>,
) -> Result<Option<Self>>
pub fn from_headers<U>( base_url: U, 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 ContentLocation
impl RefUnwindSafe for ContentLocation
impl Send for ContentLocation
impl Sync for ContentLocation
impl Unpin for ContentLocation
impl UnwindSafe for ContentLocation
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