pub struct PromptUrlGate {
pub prompt_url_map: Option<Box<HashMap<String, Box<AutomationConfig>>>>,
pub paths_map: bool,
}Expand description
URL-based prompt gating for per-URL config overrides.
This allows different prompts or configurations to be applied based on URL patterns. Useful for handling different page types differently (e.g., login pages vs. product pages).
Fields§
§prompt_url_map: Option<Box<HashMap<String, Box<AutomationConfig>>>>Map of URLs to config overrides. Keys can be exact URLs or path prefixes (if paths_map is true).
paths_map: boolWhether to use path-prefix matching (case-insensitive). When true, URLs are matched by prefix, not just exact match.
Implementations§
Source§impl PromptUrlGate
impl PromptUrlGate
Sourcepub fn with_paths_map(self) -> Self
pub fn with_paths_map(self) -> Self
Enable path-prefix matching.
Sourcepub fn add_override(&mut self, url: impl Into<String>, config: AutomationConfig)
pub fn add_override(&mut self, url: impl Into<String>, config: AutomationConfig)
Add a URL override.
Sourcepub fn match_url<'a>(
&'a self,
url: &str,
) -> Option<Option<&'a AutomationConfig>>
pub fn match_url<'a>( &'a self, url: &str, ) -> Option<Option<&'a AutomationConfig>>
Match a URL and return the config override if any.
Returns:
None=> blocked (map exists, URL not matched)Some(None)=> allowed, no overrideSome(Some(cfg))=> allowed, use override config
Sourcepub fn is_allowed(&self, url: &str) -> bool
pub fn is_allowed(&self, url: &str) -> bool
Check if a URL is allowed (matches or no map exists).
Sourcepub fn get_override(&self, url: &str) -> Option<&AutomationConfig>
pub fn get_override(&self, url: &str) -> Option<&AutomationConfig>
Get the override config for a URL, if any.
Trait Implementations§
Source§impl Clone for PromptUrlGate
impl Clone for PromptUrlGate
Source§fn clone(&self) -> PromptUrlGate
fn clone(&self) -> PromptUrlGate
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 moreSource§impl Debug for PromptUrlGate
impl Debug for PromptUrlGate
Source§impl Default for PromptUrlGate
impl Default for PromptUrlGate
Source§fn default() -> PromptUrlGate
fn default() -> PromptUrlGate
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PromptUrlGate
impl<'de> Deserialize<'de> for PromptUrlGate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for PromptUrlGate
impl PartialEq for PromptUrlGate
Source§impl Serialize for PromptUrlGate
impl Serialize for PromptUrlGate
impl StructuralPartialEq for PromptUrlGate
Auto Trait Implementations§
impl Freeze for PromptUrlGate
impl RefUnwindSafe for PromptUrlGate
impl Send for PromptUrlGate
impl Sync for PromptUrlGate
impl Unpin for PromptUrlGate
impl UnwindSafe for PromptUrlGate
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