[−][src]Struct headers::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;
Implementations
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]
scheme: &str,
host: &str,
port: impl Into<Option<u16>>
) -> Result<Self, InvalidOrigin>
Tries to build a Origin from three parts, the scheme, the host and an optional port.
Trait Implementations
impl Clone for Origin[src]
impl Debug for Origin[src]
impl Display for Origin[src]
impl Eq for Origin[src]
impl Hash for Origin[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl Header for Origin[src]
fn name() -> &'static HeaderName[src]
fn decode<'i, I>(values: &mut I) -> Result<Self, Error> where
I: Iterator<Item = &'i HeaderValue>, [src]
I: Iterator<Item = &'i HeaderValue>,
fn encode<E: Extend<HeaderValue>>(&self, values: &mut E)[src]
impl PartialEq<Origin> for Origin[src]
impl StructuralEq for Origin[src]
impl StructuralPartialEq for Origin[src]
Auto Trait Implementations
impl RefUnwindSafe for Origin
impl Send for Origin
impl Sync for Origin
impl Unpin for Origin
impl UnwindSafe for Origin
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T[src]
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,