#[non_exhaustive]pub struct SourceAllowlist {
pub source: String,
pub redirect_hosts: Vec<String>,
}Expand description
Per-source allowlist entry. Matches the schema in
docs/REDIRECT_ALLOWLIST.md §2.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.source: StringSource key. MUST match a source value in docs/SOURCES.md §1
(e.g. crossref, unpaywall, arxiv).
redirect_hosts: Vec<String>Each pattern is either a literal FQDN or a *.<suffix> glob (matches
the suffix and any subdomain — see docs/REDIRECT_ALLOWLIST.md §2.2
matching rule).
Implementations§
Source§impl SourceAllowlist
impl SourceAllowlist
Sourcepub fn new(source: impl Into<String>, redirect_hosts: Vec<String>) -> Self
pub fn new(source: impl Into<String>, redirect_hosts: Vec<String>) -> Self
Construct a new allowlist entry.
Sourcepub fn matches(&self, host: &str) -> bool
pub fn matches(&self, host: &str) -> bool
Returns true if host matches any pattern in this allowlist.
Matching is byte-level on the lowercased ASCII form of the host.
Callers MUST lowercase upstream; this method also lowercases as a
defense-in-depth measure but treats the result as ASCII (Punycode
is the caller’s responsibility per docs/REDIRECT_ALLOWLIST.md
§2.2 rule 4).
Trait Implementations§
Source§impl Clone for SourceAllowlist
impl Clone for SourceAllowlist
Source§fn clone(&self) -> SourceAllowlist
fn clone(&self) -> SourceAllowlist
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SourceAllowlist
impl RefUnwindSafe for SourceAllowlist
impl Send for SourceAllowlist
impl Sync for SourceAllowlist
impl Unpin for SourceAllowlist
impl UnsafeUnpin for SourceAllowlist
impl UnwindSafe for SourceAllowlist
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