Struct http_types::content::ContentLocation [−][src]
pub struct ContentLocation { /* fields omitted */ }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[src]
impl ContentLocation[src]pub fn new(url: Url) -> Self[src]
Create a new instance of Content-Location header.
pub fn from_headers<U>(
base_url: U,
headers: impl AsRef<Headers>
) -> Result<Option<Self>> where
U: TryInto<Url>,
U::Error: Debug, [src]
base_url: U,
headers: impl AsRef<Headers>
) -> Result<Option<Self>> where
U: TryInto<Url>,
U::Error: Debug,
Create a new instance from headers.
pub fn apply(&self, headers: impl AsMut<Headers>)[src]
Sets the header.
pub fn name(&self) -> HeaderName[src]
Get the HeaderName.
pub fn value(&self) -> HeaderValue[src]
Get the HeaderValue.
pub fn location(&self) -> &Url[src]
Get the url.
pub fn set_location<U>(&mut self, location: U) where
U: TryInto<Url>,
U::Error: Debug, [src]
U: TryInto<Url>,
U::Error: Debug,
Set the url.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ContentLocation
impl RefUnwindSafe for ContentLocationimpl Send for ContentLocation
impl Send for ContentLocationimpl Sync for ContentLocation
impl Sync for ContentLocationimpl Unpin for ContentLocation
impl Unpin for ContentLocationimpl UnwindSafe for ContentLocation
impl UnwindSafe for ContentLocation