pub struct DiscoveryRule {
pub name: String,
pub allow_patterns: Vec<String>,
pub deny_patterns: Vec<String>,
pub allow_domains: Vec<String>,
pub deny_domains: Vec<String>,
pub allow_path_prefixes: Vec<String>,
pub deny_path_prefixes: Vec<String>,
pub link_extract_options: LinkExtractOptions,
}Expand description
Rule-like configuration for runtime-managed discovery.
Fields§
§name: StringStable rule name injected into request/response metadata when matched.
allow_patterns: Vec<String>URL patterns that the source response must match.
deny_patterns: Vec<String>URL patterns that exclude the source response.
allow_domains: Vec<String>Domains or subdomains allowed for the source response.
deny_domains: Vec<String>Domains or subdomains denied for the source response.
allow_path_prefixes: Vec<String>Path prefixes allowed for the source response.
deny_path_prefixes: Vec<String>Path prefixes denied for the source response.
link_extract_options: LinkExtractOptionsLink extraction behavior used when the rule matches.
Implementations§
Source§impl DiscoveryRule
impl DiscoveryRule
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Creates a new discovery rule with the provided name.
Sourcepub fn with_link_extract_options(self, options: LinkExtractOptions) -> Self
pub fn with_link_extract_options(self, options: LinkExtractOptions) -> Self
Replaces the link extraction options used by this rule.
Sourcepub fn with_allow_patterns(
self,
patterns: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_allow_patterns( self, patterns: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Restricts this rule to source response URLs that match at least one pattern.
Sourcepub fn with_deny_patterns(
self,
patterns: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_deny_patterns( self, patterns: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Excludes this rule for source response URLs that match any pattern.
Sourcepub fn with_allow_domains(
self,
domains: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_allow_domains( self, domains: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Restricts this rule to source response domains or subdomains.
Sourcepub fn with_deny_domains(
self,
domains: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_deny_domains( self, domains: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Excludes this rule for source response domains or subdomains.
Sourcepub fn with_allow_path_prefixes(
self,
prefixes: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_allow_path_prefixes( self, prefixes: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Restricts this rule to source response paths with one of the provided prefixes.
Sourcepub fn with_deny_path_prefixes(
self,
prefixes: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_deny_path_prefixes( self, prefixes: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Excludes this rule for source response paths with one of the provided prefixes.
Sourcepub fn with_same_site_only(self, enabled: bool) -> Self
pub fn with_same_site_only(self, enabled: bool) -> Self
Sets whether only same-site links should be extracted for matching responses.
Sourcepub fn with_text_links(self, enabled: bool) -> Self
pub fn with_text_links(self, enabled: bool) -> Self
Sets whether text content should be scanned for plain-text URLs.
Sourcepub fn with_follow_allow_patterns(
self,
patterns: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_follow_allow_patterns( self, patterns: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Restricts discovered follow-up links to matching patterns.
Sourcepub fn with_follow_deny_patterns(
self,
patterns: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_follow_deny_patterns( self, patterns: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Excludes discovered follow-up links that match the given patterns.
Sourcepub fn with_follow_allow_domains(
self,
domains: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_follow_allow_domains( self, domains: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Restricts discovered follow-up links to the given domains or subdomains.
Sourcepub fn with_follow_deny_domains(
self,
domains: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_follow_deny_domains( self, domains: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Excludes discovered follow-up links for the given domains or subdomains.
Sourcepub fn with_follow_allow_path_prefixes(
self,
prefixes: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_follow_allow_path_prefixes( self, prefixes: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Restricts discovered follow-up links to the provided path prefixes.
Sourcepub fn with_follow_deny_path_prefixes(
self,
prefixes: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_follow_deny_path_prefixes( self, prefixes: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Excludes discovered follow-up links for the provided path prefixes.
Restricts attribute extraction to specific HTML tags for matching responses.
Sourcepub fn with_allowed_attributes(
self,
attributes: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_allowed_attributes( self, attributes: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Restricts attribute extraction to specific HTML attributes for matching responses.
Sourcepub fn with_allowed_link_types(
self,
link_types: impl IntoIterator<Item = LinkType>,
) -> Self
pub fn with_allowed_link_types( self, link_types: impl IntoIterator<Item = LinkType>, ) -> Self
Restricts discovered follow-up links to the provided link types.
Sourcepub fn with_denied_link_types(
self,
link_types: impl IntoIterator<Item = LinkType>,
) -> Self
pub fn with_denied_link_types( self, link_types: impl IntoIterator<Item = LinkType>, ) -> Self
Excludes the provided link types from discovered follow-up links.
Trait Implementations§
Source§impl Clone for DiscoveryRule
impl Clone for DiscoveryRule
Source§fn clone(&self) -> DiscoveryRule
fn clone(&self) -> DiscoveryRule
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DiscoveryRule
impl Debug for DiscoveryRule
Source§impl PartialEq for DiscoveryRule
impl PartialEq for DiscoveryRule
impl Eq for DiscoveryRule
impl StructuralPartialEq for DiscoveryRule
Auto Trait Implementations§
impl Freeze for DiscoveryRule
impl RefUnwindSafe for DiscoveryRule
impl Send for DiscoveryRule
impl Sync for DiscoveryRule
impl Unpin for DiscoveryRule
impl UnsafeUnpin for DiscoveryRule
impl UnwindSafe for DiscoveryRule
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.