pub struct UrlPattern { /* private fields */ }Expand description
A compiled CDP URL pattern.
Constructed via UrlPattern::new from a string using CDP wildcard
syntax. Use UrlPattern::matches to test URLs against it, and
UrlPattern::pattern_str to recover the original pattern (e.g. when
forwarding to Fetch.enable { patterns }).
Implementations§
Source§impl UrlPattern
impl UrlPattern
Sourcepub fn new(pattern: impl Into<String>) -> Result<Self, InterceptionError>
pub fn new(pattern: impl Into<String>) -> Result<Self, InterceptionError>
Compile a CDP-style URL pattern.
* matches any sequence of characters (including empty), ? matches
exactly one character, and every other regex metacharacter is escaped
so the user sees the simple wildcard surface.
Returns InterceptionError::InvalidPattern if the resulting regex
fails to compile.
Sourcepub fn pattern_str(&self) -> &str
pub fn pattern_str(&self) -> &str
The original pattern string passed to UrlPattern::new.
Useful when forwarding the pattern to CDP via
Fetch.enable { patterns: [{ urlPattern: ... }] }.
Trait Implementations§
Source§impl Clone for UrlPattern
impl Clone for UrlPattern
Source§fn clone(&self) -> UrlPattern
fn clone(&self) -> UrlPattern
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 UrlPattern
impl RefUnwindSafe for UrlPattern
impl Send for UrlPattern
impl Sync for UrlPattern
impl Unpin for UrlPattern
impl UnsafeUnpin for UrlPattern
impl UnwindSafe for UrlPattern
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