pub struct DomainMatchingRule { /* private fields */ }Expand description
A struct representing a prefix-or-suffix matching rule. This struct checks if a domain is contained in a list of prefixes or suffixes with longest match rule.
Implementations§
Source§impl DomainMatchingRule
impl DomainMatchingRule
Sourcepub fn find_suffix_match(&self, domain_name: &str) -> bool
pub fn find_suffix_match(&self, domain_name: &str) -> bool
Find a domain contained in the list of suffixes. Returns true if found If not found, return false. Short-circuit evaluation, it immediately stops when the first match is found.
Sourcepub fn find_suffix_match_all(&self, domain_name: &str) -> Vec<String>
pub fn find_suffix_match_all(&self, domain_name: &str) -> Vec<String>
Find a domain contained in the list of suffixes. Returns list of all matched suffixes.
Sourcepub fn find_suffix_match_longest(&self, domain_name: &str) -> Option<String>
pub fn find_suffix_match_longest(&self, domain_name: &str) -> Option<String>
Find a domain contained in the list of suffixes. Returns the longest match. If not found, return None.
Sourcepub fn find_prefix_match(&self, domain_name: &str) -> bool
pub fn find_prefix_match(&self, domain_name: &str) -> bool
Find a domain contained in the list of prefixes. Returns true if found If not found, return false. Short-circuit evaluation, it immediately stops when the first match is found.
Sourcepub fn find_prefix_match_all(&self, domain_name: &str) -> Vec<String>
pub fn find_prefix_match_all(&self, domain_name: &str) -> Vec<String>
Find a domain contained in the list of prefixes. Returns list of all matched prefixes.
Sourcepub fn find_prefix_match_longest(&self, domain_name: &str) -> Option<String>
pub fn find_prefix_match_longest(&self, domain_name: &str) -> Option<String>
Find a domain contained in the list of prefixes. Returns the longest match. If not found, return None.
Sourcepub fn is_matched(&self, domain_name: &str) -> bool
pub fn is_matched(&self, domain_name: &str) -> bool
Check if a domain is contained in the list of prefixes or suffixes We should note that
- the argument
domain_nameshould be in lowercase - the argument
domain_nameshould not contain a leading dot
Trait Implementations§
Source§impl Clone for DomainMatchingRule
impl Clone for DomainMatchingRule
Source§fn clone(&self) -> DomainMatchingRule
fn clone(&self) -> DomainMatchingRule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more