Struct adblock::blocker::BlockerResult
source · pub struct BlockerResult {
pub matched: bool,
pub important: bool,
pub redirect: Option<String>,
pub rewritten_url: Option<String>,
pub exception: Option<String>,
pub filter: Option<String>,
}
Expand description
Describes how a particular network request should be handled.
Fields§
§matched: bool
Was a blocking filter matched for this request?
important: bool
Important is used to signal that a rule with the important
option
matched. An important
match means that exceptions should not apply
and no further checking is neccesary–the request should be blocked
(empty body or cancelled).
Brave Browser keeps multiple instances of Blocker
, so important
here is used to correct behaviour between them: checking should stop
instead of moving to the next instance iff an important
rule matched.
redirect: Option<String>
Specifies what to load instead of the original request, rather than
just blocking it outright. This can come from a filter with a redirect
or redirect-rule
option. If present, the field will contain the body
of the redirect to be injected.
Note that the presence of a redirect does not imply that the request
should be blocked. The redirect-rule
option can produce a redirection
that’s only applied if another blocking filter matches a request.
rewritten_url: Option<String>
removeparam
may remove URL parameters. If the original request URL was
modified at all, the new version will be here. This should be used
as long as the request is not blocked.
exception: Option<String>
Contains a string representation of any matched exception rule. Effectively this means that there was a match, but the request should not be blocked.
If debugging was not enabled (see crate::FilterSet::new
), this
will only contain a constant "NetworkFilter"
placeholder string.
filter: Option<String>
When matched
is true, this contains a string representation of the
matched blocking rule.
If debugging was not enabled (see crate::FilterSet::new
), this
will only contain a constant "NetworkFilter"
placeholder string.
Trait Implementations§
source§impl Debug for BlockerResult
impl Debug for BlockerResult
source§impl Default for BlockerResult
impl Default for BlockerResult
source§fn default() -> BlockerResult
fn default() -> BlockerResult
Auto Trait Implementations§
impl Freeze for BlockerResult
impl RefUnwindSafe for BlockerResult
impl Send for BlockerResult
impl Sync for BlockerResult
impl Unpin for BlockerResult
impl UnwindSafe for BlockerResult
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more