pub struct Origin(/* private fields */);Expand description
The origin of a document or a fetch initiator.
Network schemes (http, https, ftp, ws, wss) become tuple origins
whose equality ignores default ports. Everything else (resource:, data:,
about:, file:, custom schemes) is opaque: it serializes as "null" in
JavaScript and never compares equal to another origin.
Implementations§
Source§impl Origin
impl Origin
Sourcepub fn from_url_string(url: &str) -> Self
pub fn from_url_string(url: &str) -> Self
Computes the origin of a URL string, falling back to a fresh opaque origin when the string does not parse.
Sourcepub fn ascii_serialization(&self) -> String
pub fn ascii_serialization(&self) -> String
Serialization exposed to JavaScript: scheme://host[:port] or "null".
Sourcepub fn is_network(&self) -> bool
pub fn is_network(&self) -> bool
Whether this is an http(s):// tuple origin that proxies a real web page.
Sourcepub fn same_origin(&self, other: &Self) -> bool
pub fn same_origin(&self, other: &Self) -> bool
Same-origin check. Opaque origins are never equal to any other origin.
Trait Implementations§
impl Eq for Origin
impl StructuralPartialEq for Origin
Auto Trait Implementations§
impl Freeze for Origin
impl RefUnwindSafe for Origin
impl Send for Origin
impl Sync for Origin
impl Unpin for Origin
impl UnsafeUnpin for Origin
impl UnwindSafe for Origin
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more