Struct ajars_surf::surf::http::content::ContentLocation
[−]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
impl ContentLocation
impl ContentLocation
pub fn new(url: Url) -> ContentLocation
pub fn new(url: Url) -> ContentLocation
Create a new instance of Content-Location
header.
pub fn from_headers<U>(
base_url: U,
headers: impl AsRef<Headers>
) -> Result<Option<ContentLocation>, Error> where
U: TryInto<Url>,
<U as TryInto<Url>>::Error: Debug,
pub fn from_headers<U>(
base_url: U,
headers: impl AsRef<Headers>
) -> Result<Option<ContentLocation>, Error> where
U: TryInto<Url>,
<U as TryInto<Url>>::Error: Debug,
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 ContentLocation
impl Send for ContentLocation
impl Sync for ContentLocation
impl Unpin for ContentLocation
impl UnwindSafe for ContentLocation
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