Menu

Struct

Origin

kurogane::OriginSource
pub struct Origin(/* private field */);

Security origin of a frame as scheme://host[:port] or opaque.

Serialized like location.origin with a lowercase scheme and host and default ports elided. Frames without a host (file:, data:, about:) and unparseable URLs are opaque. An opaque origin matches no rule and no grant.

Associated constants

#const OPAQUE: Origin = _

The opaque origin.

Methods

#pub fn from_url(url: &str) -> Origin

The origin of the document at url (browser side; never fails).

#pub fn parse(text: &str) -> Result<Origin, OriginError>

Parses a configured origin such as app://app or http://localhost:5173.

Errors

Returns OriginError when text is not a URL, has no host, is a file: URL, or carries a path, query, fragment or credentials.

#pub fn is_opaque(&self) -> bool

Returns true for the opaque origin.

Trait implementations