pub enum OriginPattern {
Exact(Origin),
Wildcard {
scheme: String,
suffix: String,
},
Any,
}Expand description
A rule-declared origin pattern.
Three forms are supported:
- Exact:
https://example.org— matches only that origin. - Wildcard subdomain:
https://*.example.org— matches any single-or-multi-level subdomain ofexample.orgon the same scheme. Does not match the bareexample.org. - Global wildcard:
*— matches any origin. Equivalent to “origin gate effectively disabled for this rule”. Discouraged; requires explicit opt-in (the caller must write*literally).
Variants§
Exact(Origin)
Exact origin match.
Wildcard
Wildcard subdomain: scheme + suffix (e.g. https + example.org).
Any
Global wildcard (*). Matches any origin.
Implementations§
Source§impl OriginPattern
impl OriginPattern
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
Parse a pattern string.
"*"→OriginPattern::Any"https://*.example.org"→OriginPattern::Wildcard"https://example.org"/"https://example.org:8443"→OriginPattern::Exact
Returns None for malformed input (missing scheme, empty host,
trailing slashes, etc). The invariant in the DDD doc is that
only canonical origins are stored; the exact-origin branch uses
Origin::parse for strict validation.
Trait Implementations§
Source§impl Clone for OriginPattern
impl Clone for OriginPattern
Source§fn clone(&self) -> OriginPattern
fn clone(&self) -> OriginPattern
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OriginPattern
impl Debug for OriginPattern
Source§impl PartialEq for OriginPattern
impl PartialEq for OriginPattern
Source§fn eq(&self, other: &OriginPattern) -> bool
fn eq(&self, other: &OriginPattern) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for OriginPattern
impl StructuralPartialEq for OriginPattern
Auto Trait Implementations§
impl Freeze for OriginPattern
impl RefUnwindSafe for OriginPattern
impl Send for OriginPattern
impl Sync for OriginPattern
impl Unpin for OriginPattern
impl UnsafeUnpin for OriginPattern
impl UnwindSafe for OriginPattern
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