Struct headers_ext::Origin [−][src]
pub struct Origin(_);
The Origin
header.
The Origin
header is a version of the Referer
header that is used for all HTTP fetches and POST
s 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]
impl Origin
pub const NULL: Origin
NULL: Origin = Origin(OriginOrNull::Null)
The literal null
Origin header.
pub fn is_null(&self) -> bool
[src]
pub fn is_null(&self) -> bool
Checks if Origin
is null
.
pub fn scheme(&self) -> &str
[src]
pub fn scheme(&self) -> &str
Get the "scheme" part of this origin.
pub fn hostname(&self) -> &str
[src]
pub fn hostname(&self) -> &str
Get the "hostname" part of this origin.
pub fn port(&self) -> Option<u16>
[src]
pub fn port(&self) -> Option<u16>
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]
pub fn try_from_parts(
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 Clone for Origin
fn clone(&self) -> Origin
[src]
fn clone(&self) -> Origin
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Origin
[src]
impl Debug for Origin
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for Origin
[src]
impl PartialEq for Origin
fn eq(&self, other: &Origin) -> bool
[src]
fn eq(&self, other: &Origin) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Origin) -> bool
[src]
fn ne(&self, other: &Origin) -> bool
This method tests for !=
.
impl Eq for Origin
[src]
impl Eq for Origin
impl Hash for Origin
[src]
impl Hash for Origin
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Display for Origin
[src]
impl Display for Origin