Enum Origin
pub enum Origin
The origin of an URL
Two URLs with the same origin are considered to originate from the same entity and can therefore trust each other.
The origin is determined based on the scheme as follows:
- If the scheme is "blob" the origin is the origin of the URL contained in the path component. If parsing fails, it is an opaque origin.
- If the scheme is "ftp", "http", "https", "ws", or "wss", then the origin is a tuple of the scheme, host, and port.
- If the scheme is anything else, the origin is opaque, meaning the URL does not have the same origin as any other URL.
For more information see https://url.spec.whatwg.org/#origin
Variants
-
Opaque(OpaqueOrigin) A globally unique identifier
-
Tuple(String, Host<String>, u16) Consists of the URL's scheme, host and port
Implementations
impl Origin
fn new_opaque() -> SelfCreates a new opaque origin that is only equal to itself.
fn is_tuple(&self) -> boolReturn whether this origin is a (scheme, host, port) tuple (as opposed to an opaque origin).
fn ascii_serialization(&self) -> Stringhttps://html.spec.whatwg.org/multipage/#ascii-serialisation-of-an-origin
fn unicode_serialization(&self) -> Stringhttps://html.spec.whatwg.org/multipage/#unicode-serialisation-of-an-origin
Trait Implementations
impl Clone for Origin
fn clone(&self) -> Self
impl Debug for Origin
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for Origin
impl Hash for Origin
fn hash<__H: Hasher>(&self, state: &mut __H)
impl PartialEq for Origin
fn eq(&self, other: &Self) -> bool
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
impl<T> Any for Origin
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Origin
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Origin
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Origin
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Origin
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Origin
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Origin
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Origin
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Origin
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>