[][src]Struct headers::Origin

pub struct Origin(_);

The Origin header.

The Origin header is a version of the Referer header that is used for all HTTP fetches and POSTs whose CORS flag is set. This header is often used to inform recipients of the security context of where the request was initiated.

Following the spec, https://fetch.spec.whatwg.org/#origin-header, the value of this header is composed of a String (scheme), Host (host/port)

Examples

use headers::Origin;

let origin = Origin::NULL;

Methods

impl Origin[src]

pub const NULL: Origin[src]

The literal null Origin header.

pub fn is_null(&self) -> bool[src]

Checks if Origin is null.

pub fn scheme(&self) -> &str[src]

Get the "scheme" part of this origin.

pub fn hostname(&self) -> &str[src]

Get the "hostname" part of this origin.

pub fn port(&self) -> Option<u16>[src]

Get the "port" part of this origin.

pub fn try_from_parts(
    scheme: &str,
    host: &str,
    port: impl Into<Option<u16>>
) -> Result<Self, InvalidOrigin>
[src]

Tries to build a Origin from three parts, the scheme, the host and an optional port.

Trait Implementations

impl Eq for Origin[src]

impl PartialEq<Origin> for Origin[src]

impl Clone for Origin[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Origin[src]

impl Display for Origin[src]

impl Hash for Origin[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Header for Origin[src]

Auto Trait Implementations

impl Send for Origin

impl Sync for Origin

Blanket Implementations

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

impl<T> From for T[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

impl<T> Same for T

type Output = T

Should always be Self