pub struct DomainAllowlist { /* private fields */ }Expand description
List of allowed domains
Implementations§
Source§impl DomainAllowlist
impl DomainAllowlist
Sourcepub fn allow_domain(&mut self, domain: &str)
pub fn allow_domain(&mut self, domain: &str)
Add an allowed domain
Sourcepub fn allow_domains(&mut self, domains: &[&str])
pub fn allow_domains(&mut self, domains: &[&str])
Add multiple allowed domains
Sourcepub fn block_domain(&mut self, domain: &str)
pub fn block_domain(&mut self, domain: &str)
Add a blocked domain
Sourcepub fn block_domains(&mut self, domains: &[&str])
pub fn block_domains(&mut self, domains: &[&str])
Add multiple blocked domains
Sourcepub fn allow_pattern(&mut self, pattern: &str) -> Result<(), Error>
pub fn allow_pattern(&mut self, pattern: &str) -> Result<(), Error>
Add an allowed regex pattern
Sourcepub fn block_pattern(&mut self, pattern: &str) -> Result<(), Error>
pub fn block_pattern(&mut self, pattern: &str) -> Result<(), Error>
Add a blocked regex pattern
Sourcepub fn is_allowed(&self, url: &Url) -> bool
pub fn is_allowed(&self, url: &Url) -> bool
Check if a URL is allowed
Sourcepub fn is_domain_allowed(&self, domain: &str) -> bool
pub fn is_domain_allowed(&self, domain: &str) -> bool
Check if a domain is allowed
Sourcepub fn allowed_domains(&self) -> &HashSet<String>
pub fn allowed_domains(&self) -> &HashSet<String>
Return the allowed domains
Sourcepub fn blocked_domains(&self) -> &HashSet<String>
pub fn blocked_domains(&self) -> &HashSet<String>
Return the blocked domains
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DomainAllowlist
impl RefUnwindSafe for DomainAllowlist
impl Send for DomainAllowlist
impl Sync for DomainAllowlist
impl Unpin for DomainAllowlist
impl UnwindSafe for DomainAllowlist
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