Struct adblock::filters::network::NetworkFilter
source · pub struct NetworkFilter {
pub mask: NetworkFilterMask,
pub filter: FilterPart,
pub opt_domains: Option<Vec<Hash>>,
pub opt_not_domains: Option<Vec<Hash>>,
pub modifier_option: Option<String>,
pub hostname: Option<String>,
pub raw_line: Option<Box<String>>,
pub id: Hash,
pub opt_domains_union: Option<Hash>,
pub opt_not_domains_union: Option<Hash>,
/* private fields */
}
Fields§
§mask: NetworkFilterMask
§filter: FilterPart
§opt_domains: Option<Vec<Hash>>
§opt_not_domains: Option<Vec<Hash>>
§modifier_option: Option<String>
Used for $redirect
, $redirect-rule
, $csp
, and $removeparam
- only one of which is
supported per-rule.
hostname: Option<String>
§raw_line: Option<Box<String>>
§id: Hash
§opt_domains_union: Option<Hash>
§opt_not_domains_union: Option<Hash>
Implementations§
source§impl NetworkFilter
impl NetworkFilter
pub fn parse( line: &str, debug: bool, _opts: ParseOptions, ) -> Result<Self, NetworkFilterError>
sourcepub fn parse_hosts_style(
hostname: &str,
debug: bool,
) -> Result<Self, NetworkFilterError>
pub fn parse_hosts_style( hostname: &str, debug: bool, ) -> Result<Self, NetworkFilterError>
Given a hostname, produces an equivalent filter parsed from the form "||hostname^"
, to
emulate the behavior of hosts-style blocking.
pub fn get_id_without_badfilter(&self) -> Hash
pub fn get_id(&self) -> Hash
pub fn get_tokens(&self) -> Vec<Vec<Hash>>
pub fn is_exception(&self) -> bool
pub fn is_hostname_anchor(&self) -> bool
pub fn is_right_anchor(&self) -> bool
pub fn is_left_anchor(&self) -> bool
pub fn is_important(&self) -> bool
pub fn is_redirect(&self) -> bool
pub fn is_removeparam(&self) -> bool
pub fn also_block_redirect(&self) -> bool
pub fn is_badfilter(&self) -> bool
pub fn is_generic_hide(&self) -> bool
pub fn is_regex(&self) -> bool
pub fn is_complete_regex(&self) -> bool
pub fn is_csp(&self) -> bool
Trait Implementations§
source§impl Clone for NetworkFilter
impl Clone for NetworkFilter
source§fn clone(&self) -> NetworkFilter
fn clone(&self) -> NetworkFilter
Returns a copy 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 NetworkFilter
impl Debug for NetworkFilter
source§impl<'de> Deserialize<'de> for NetworkFilter
impl<'de> Deserialize<'de> for NetworkFilter
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 Display for NetworkFilter
impl Display for NetworkFilter
source§impl From<NetworkFilter> for ParsedFilter
impl From<NetworkFilter> for ParsedFilter
source§fn from(v: NetworkFilter) -> Self
fn from(v: NetworkFilter) -> Self
Converts to this type from the input type.
source§impl NetworkMatchable for NetworkFilter
impl NetworkMatchable for NetworkFilter
source§impl PartialEq for NetworkFilter
impl PartialEq for NetworkFilter
The ID of a filter is assumed to be correctly calculated for the purposes of this implementation.
source§impl PartialOrd for NetworkFilter
impl PartialOrd for NetworkFilter
Filters are sorted by ID to preserve a stable ordering of data in the serialized format.
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreAuto Trait Implementations§
impl Freeze for NetworkFilter
impl RefUnwindSafe for NetworkFilter
impl Send for NetworkFilter
impl Sync for NetworkFilter
impl Unpin for NetworkFilter
impl UnwindSafe for NetworkFilter
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