[][src]Struct tide::http::content::ContentLocation

pub struct ContentLocation { /* fields omitted */ }

Indicates an alternate location for the returned data.

MDN Documentation

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]

pub fn new(url: Url) -> ContentLocation[src]

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
[src]

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 as TryInto<Url>>::Error: Debug
[src]

Set the url.

Trait Implementations

impl Debug for ContentLocation[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,